TvPlanIt: Fix writable data file location of DayViewWrapStyleDemo for cocoa.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8895 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-07-22 15:03:31 +00:00
parent 9f444a7a30
commit ad1cd546a6
4 changed files with 35 additions and 30 deletions

View File

@ -0,0 +1,87 @@
unit dvwsMain;
{$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
VpIniDataStore1.FileName := GetAppConfigDir(false) + 'data.ini';
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.