You've already forked lazarus-ccr
CalLite: Add demo for multi-selection of dates
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6777 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
82
components/callite/demo3/main.lpi
Normal file
82
components/callite/demo3/main.lpi
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<General>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<MainUnit Value="0"/>
|
||||||
|
<Title Value="main"/>
|
||||||
|
<Scaled Value="True"/>
|
||||||
|
<ResourceType Value="res"/>
|
||||||
|
<UseXPManifest Value="True"/>
|
||||||
|
<XPManifest>
|
||||||
|
<DpiAware Value="True"/>
|
||||||
|
</XPManifest>
|
||||||
|
<Icon Value="0"/>
|
||||||
|
</General>
|
||||||
|
<BuildModes Count="1">
|
||||||
|
<Item1 Name="Default" Default="True"/>
|
||||||
|
</BuildModes>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
<UseFileFilters Value="True"/>
|
||||||
|
</PublishOptions>
|
||||||
|
<RunParams>
|
||||||
|
<FormatVersion Value="2"/>
|
||||||
|
<Modes Count="0"/>
|
||||||
|
</RunParams>
|
||||||
|
<RequiredPackages Count="2">
|
||||||
|
<Item1>
|
||||||
|
<PackageName Value="callight_pkg"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<PackageName Value="LCL"/>
|
||||||
|
</Item2>
|
||||||
|
</RequiredPackages>
|
||||||
|
<Units Count="2">
|
||||||
|
<Unit0>
|
||||||
|
<Filename Value="main.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="selectiondemo.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="Form1"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
<UnitName Value="SelectionDemo"/>
|
||||||
|
</Unit1>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="main"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Linking>
|
||||||
|
<Options>
|
||||||
|
<Win32>
|
||||||
|
<GraphicApplication Value="True"/>
|
||||||
|
</Win32>
|
||||||
|
</Options>
|
||||||
|
</Linking>
|
||||||
|
</CompilerOptions>
|
||||||
|
<Debugging>
|
||||||
|
<Exceptions Count="3">
|
||||||
|
<Item1>
|
||||||
|
<Name Value="EAbort"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<Name Value="ECodetoolError"/>
|
||||||
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<Name Value="EFOpenError"/>
|
||||||
|
</Item3>
|
||||||
|
</Exceptions>
|
||||||
|
</Debugging>
|
||||||
|
</CONFIG>
|
22
components/callite/demo3/main.lpr
Normal file
22
components/callite/demo3/main.lpr
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
program main;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||||
|
cthreads,
|
||||||
|
{$ENDIF}{$ENDIF}
|
||||||
|
Interfaces, // this includes the LCL widgetset
|
||||||
|
Forms, SelectionDemo
|
||||||
|
{ you can add units after this };
|
||||||
|
|
||||||
|
{$R *.res}
|
||||||
|
|
||||||
|
begin
|
||||||
|
RequireDerivedFormResource:=True;
|
||||||
|
Application.Scaled:=True;
|
||||||
|
Application.Initialize;
|
||||||
|
Application.CreateForm(TForm1, Form1);
|
||||||
|
Application.Run;
|
||||||
|
end.
|
||||||
|
|
83
components/callite/demo3/selectiondemo.lfm
Normal file
83
components/callite/demo3/selectiondemo.lfm
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
object Form1: TForm1
|
||||||
|
Left = 282
|
||||||
|
Height = 248
|
||||||
|
Top = 133
|
||||||
|
Width = 398
|
||||||
|
Caption = 'Date selection demo'
|
||||||
|
ClientHeight = 248
|
||||||
|
ClientWidth = 398
|
||||||
|
LCLVersion = '2.1.0.0'
|
||||||
|
object ListBox1: TListBox
|
||||||
|
Left = 287
|
||||||
|
Height = 240
|
||||||
|
Top = 4
|
||||||
|
Width = 107
|
||||||
|
Align = alRight
|
||||||
|
BorderSpacing.Around = 4
|
||||||
|
ItemHeight = 0
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object Panel1: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 248
|
||||||
|
Top = 0
|
||||||
|
Width = 278
|
||||||
|
Align = alClient
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 248
|
||||||
|
ClientWidth = 278
|
||||||
|
TabOrder = 1
|
||||||
|
object CalendarLite1: TCalendarLite
|
||||||
|
AnchorSideLeft.Control = Panel1
|
||||||
|
AnchorSideTop.Control = Panel1
|
||||||
|
AnchorSideRight.Control = Panel1
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = CbMultiselect
|
||||||
|
Left = 4
|
||||||
|
Height = 217
|
||||||
|
Top = 4
|
||||||
|
Width = 274
|
||||||
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
|
BorderSpacing.Left = 4
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
BorderSpacing.Bottom = 4
|
||||||
|
Constraints.MinHeight = 120
|
||||||
|
Constraints.MinWidth = 120
|
||||||
|
ParentColor = False
|
||||||
|
TabOrder = 0
|
||||||
|
TabStop = True
|
||||||
|
Colors.TodayFrameColor = clGray
|
||||||
|
Date = 43463
|
||||||
|
DisplayTexts = '"Today is %s","mmm dd"", ""yyyy","Holidays in %d","There are no holidays set for %d","dddd"", "" mmm dd"", ""yyyy","mmmm yyyy"'
|
||||||
|
MultiSelect = True
|
||||||
|
Options = [coBoldHolidays, coBoldTopRow, coDayLine, coShowBorder, coShowHolidays, coShowTodayFrame, coShowTodayName, coShowTodayRow, coShowWeekend]
|
||||||
|
WeekendDays = [dowSunday, dowSaturday]
|
||||||
|
OnDateChange = CalendarLite1DateChange
|
||||||
|
end
|
||||||
|
object CbMultiselect: TCheckBox
|
||||||
|
AnchorSideLeft.Control = Panel1
|
||||||
|
AnchorSideBottom.Control = Panel1
|
||||||
|
AnchorSideBottom.Side = asrBottom
|
||||||
|
Left = 4
|
||||||
|
Height = 19
|
||||||
|
Top = 225
|
||||||
|
Width = 100
|
||||||
|
Anchors = [akLeft, akBottom]
|
||||||
|
BorderSpacing.Left = 4
|
||||||
|
BorderSpacing.Bottom = 4
|
||||||
|
Caption = 'Multi-selection'
|
||||||
|
Checked = True
|
||||||
|
OnChange = CbMultiselectChange
|
||||||
|
State = cbChecked
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object Splitter1: TSplitter
|
||||||
|
Left = 278
|
||||||
|
Height = 248
|
||||||
|
Top = 0
|
||||||
|
Width = 5
|
||||||
|
Align = alRight
|
||||||
|
ResizeAnchor = akRight
|
||||||
|
end
|
||||||
|
end
|
60
components/callite/demo3/selectiondemo.pas
Normal file
60
components/callite/demo3/selectiondemo.pas
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
unit SelectionDemo;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
|
||||||
|
CalendarLite;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
TForm1 = class(TForm)
|
||||||
|
CalendarLite1: TCalendarLite;
|
||||||
|
CbMultiselect: TCheckBox;
|
||||||
|
ListBox1: TListBox;
|
||||||
|
Panel1: TPanel;
|
||||||
|
Splitter1: TSplitter;
|
||||||
|
procedure CalendarLite1DateChange(Sender: TObject);
|
||||||
|
procedure CbMultiselectChange(Sender: TObject);
|
||||||
|
private
|
||||||
|
|
||||||
|
public
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Form1: TForm1;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
procedure TForm1.CalendarLite1DateChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
d: TDate;
|
||||||
|
selDates: TCalDateArray;
|
||||||
|
begin
|
||||||
|
Listbox1.Items.BeginUpdate;
|
||||||
|
try
|
||||||
|
Listbox1.Items.Clear;
|
||||||
|
selDates := CalendarLite1.SelectedDates;
|
||||||
|
for d in selDates do
|
||||||
|
Listbox1.Items.Add(DateToStr(d));
|
||||||
|
finally
|
||||||
|
Listbox1.Items.EndUpdate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.CbMultiselectChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
CalendarLite1.MultiSelect := cbMultiSelect.Checked;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
@ -371,7 +371,7 @@ uses
|
|||||||
resourcestring
|
resourcestring
|
||||||
rsCalTodayIs = 'Today is %s';
|
rsCalTodayIs = 'Today is %s';
|
||||||
rsCalTodayFormat = 'mmm dd, yyyy';
|
rsCalTodayFormat = 'mmm dd, yyyy';
|
||||||
rsCalTodayFormatLong = 'dddd mmm dd, yyyy';
|
rsCalTodayFormatLong = 'dddd, mmm dd, yyyy';
|
||||||
rsCalCaptionFormat = 'mmmm yyyy';
|
rsCalCaptionFormat = 'mmmm yyyy';
|
||||||
rsCalHolidaysIn = 'Holidays in %d';
|
rsCalHolidaysIn = 'Holidays in %d';
|
||||||
rsCalNoHolidaysIn = 'There are no holidays set for %d';
|
rsCalNoHolidaysIn = 'There are no holidays set for %d';
|
||||||
|
Reference in New Issue
Block a user