2023-07-22 15:03:31 +00:00
|
|
|
unit dvwsMain;
|
2023-07-22 10:54:38 +00:00
|
|
|
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, Spin,
|
|
|
|
StdCtrls, VpBaseDS, VpIniDs, VpDayView, VpData;
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
|
|
{ TForm1 }
|
|
|
|
|
|
|
|
TForm1 = class(TForm)
|
|
|
|
ImageList1: TImageList;
|
|
|
|
ImageList2: TImageList;
|
|
|
|
Label1: TLabel;
|
|
|
|
Label2: TLabel;
|
|
|
|
Panel1: TPanel;
|
|
|
|
RadioGroup1: TRadioGroup;
|
|
|
|
seRowHeight: TSpinEdit;
|
|
|
|
seColumns: TSpinEdit;
|
|
|
|
VpControlLink1: TVpControlLink;
|
|
|
|
VpDayView1: TVpDayView;
|
|
|
|
VpIniDatastore1: TVpIniDatastore;
|
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
|
procedure RadioGroup1Click(Sender: TObject);
|
|
|
|
procedure seColumnsChange(Sender: TObject);
|
|
|
|
procedure seRowHeightChange(Sender: TObject);
|
|
|
|
private
|
|
|
|
|
|
|
|
public
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
var
|
|
|
|
Form1: TForm1;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
{$R *.lfm}
|
|
|
|
|
|
|
|
{ TForm1 }
|
|
|
|
|
|
|
|
procedure TForm1.FormCreate(Sender: TObject);
|
|
|
|
var
|
|
|
|
d: TDate;
|
|
|
|
begin
|
2023-07-22 15:03:31 +00:00
|
|
|
VpIniDataStore1.FileName := GetAppConfigDir(false) + 'data.ini';
|
|
|
|
|
2023-07-22 10:54:38 +00:00
|
|
|
if VpIniDatastore1.Resources.Count = 0 then
|
|
|
|
VpDayView1.CheckCreateResource;
|
|
|
|
if VpIniDatastore1.Resources.Count > 0 then
|
|
|
|
VpIniDatastore1.Resource := VpIniDatastore1.Resources.Items[0];
|
|
|
|
|
|
|
|
d := Date();
|
|
|
|
if VpIniDatastore1.Resource.Schedule.EventCountByDay(d) = 0 then
|
|
|
|
with VpIniDatastore1.Resource.Schedule.AddEvent(
|
|
|
|
VpIniDatastore1.GetNextID('Resource'),
|
|
|
|
d + EncodeTime(8,0,0,0),
|
|
|
|
d + EncodeTime(8,30,0,0)
|
|
|
|
) do
|
|
|
|
Description := 'Test1 test2 test3 test4 test5 test6 test7';
|
|
|
|
|
|
|
|
RadioGroup1.ItemIndex := Integer(VpDayView1.WrapStyle);
|
|
|
|
seRowHeight.Value := VpDayView1.RowHeight;
|
|
|
|
seColumns.Value := VpDayView1.NumDays;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TForm1.RadioGroup1Click(Sender: TObject);
|
|
|
|
begin
|
|
|
|
VpDayView1.WrapStyle := TVpDVWrapStyle(Radiogroup1.ItemIndex);
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TForm1.seColumnsChange(Sender: TObject);
|
|
|
|
begin
|
|
|
|
VpDayView1.NumDays := seColumns.Value;;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TForm1.seRowHeightChange(Sender: TObject);
|
|
|
|
begin
|
|
|
|
VpDayView1.RowHeight := seRowHeight.Value;
|
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|
|
|
|
|