You've already forked lazarus-ccr
Initial commit v0.0.1
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3519 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
BIN
components/longtimer/demo/longtimerdemo.ico
Normal file
BIN
components/longtimer/demo/longtimerdemo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 134 KiB |
174
components/longtimer/demo/longtimerdemo.lpi
Normal file
174
components/longtimer/demo/longtimerdemo.lpi
Normal file
@@ -0,0 +1,174 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="LongTimer Demo"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="3">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
<Item2 Name="Debug">
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="project1"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<IncludeAssertionCode Value="True"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<Checks>
|
||||
<IOChecks Value="True"/>
|
||||
<RangeChecks Value="True"/>
|
||||
<OverflowChecks Value="True"/>
|
||||
<StackChecks Value="True"/>
|
||||
</Checks>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
<UseHeaptrc Value="True"/>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<MsgFileName Value=""/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</Item2>
|
||||
<Item3 Name="Release">
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="longtimerdemo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="."/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<SmartLinkUnit Value="True"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="3"/>
|
||||
</Optimizations>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<GenerateDebugInfo Value="False"/>
|
||||
</Debugging>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<MsgFileName Value=""/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</Item3>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="longtimerpackage"/>
|
||||
<MinVersion Release="1" Valid="True"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="longtimerdemo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="longtimerdemo"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="mainform"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="umainform"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="project1"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<MsgFileName Value=""/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
||||
21
components/longtimer/demo/longtimerdemo.lpr
Normal file
21
components/longtimer/demo/longtimerdemo.lpr
Normal file
@@ -0,0 +1,21 @@
|
||||
program longtimerdemo;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, umainform;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
Application.Title:='LongTimer Demo';
|
||||
RequireDerivedFormResource := True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(Tmainform, mainform);
|
||||
Application.Run;
|
||||
end.
|
||||
|
||||
BIN
components/longtimer/demo/longtimerdemo.res
Normal file
BIN
components/longtimer/demo/longtimerdemo.res
Normal file
Binary file not shown.
159
components/longtimer/demo/umainform.lfm
Normal file
159
components/longtimer/demo/umainform.lfm
Normal file
@@ -0,0 +1,159 @@
|
||||
object mainform: Tmainform
|
||||
Left = 1162
|
||||
Height = 264
|
||||
Top = 272
|
||||
Width = 437
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'Application Title'
|
||||
ClientHeight = 264
|
||||
ClientWidth = 437
|
||||
DefaultMonitor = dmPrimary
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.2.4.0'
|
||||
object cmd_Close: TBitBtn
|
||||
Left = 104
|
||||
Height = 30
|
||||
Top = 224
|
||||
Width = 75
|
||||
DefaultCaption = True
|
||||
Kind = bkClose
|
||||
ModalResult = 11
|
||||
TabOrder = 0
|
||||
end
|
||||
object memo_ReportTimerEvent: TMemo
|
||||
Left = 192
|
||||
Height = 240
|
||||
Top = 8
|
||||
Width = 232
|
||||
Lines.Strings = (
|
||||
'Memo1'
|
||||
)
|
||||
TabOrder = 1
|
||||
end
|
||||
object cmd_StopTimer: TButton
|
||||
Left = 16
|
||||
Height = 25
|
||||
Top = 197
|
||||
Width = 75
|
||||
Caption = 'Stop Timer'
|
||||
OnClick = cmd_StopTimerClick
|
||||
TabOrder = 2
|
||||
end
|
||||
object cmd_StartTimer: TButton
|
||||
Left = 104
|
||||
Height = 25
|
||||
Top = 197
|
||||
Width = 75
|
||||
Caption = 'Start Timer'
|
||||
OnClick = cmd_StartTimerClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object crp_SetTimer: TGroupBox
|
||||
Left = 8
|
||||
Height = 176
|
||||
Top = 8
|
||||
Width = 184
|
||||
Caption = 'Set up LongTimer'
|
||||
ClientHeight = 158
|
||||
ClientWidth = 180
|
||||
TabOrder = 4
|
||||
object Label1: TLabel
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 28
|
||||
Caption = 'Every'
|
||||
ParentColor = False
|
||||
end
|
||||
object cmb_IntervalType: TComboBox
|
||||
Left = 72
|
||||
Height = 23
|
||||
Top = 16
|
||||
Width = 100
|
||||
ItemHeight = 15
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'Day'
|
||||
'Week'
|
||||
'Month'
|
||||
)
|
||||
OnChange = cmb_IntervalTypeChange
|
||||
Style = csDropDownList
|
||||
TabOrder = 0
|
||||
Text = 'Day'
|
||||
end
|
||||
object Label3: TLabel
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 48
|
||||
Width = 61
|
||||
Caption = 'Day or Date'
|
||||
ParentColor = False
|
||||
end
|
||||
object cmb_weekordate: TComboBox
|
||||
Left = 72
|
||||
Height = 23
|
||||
Top = 44
|
||||
Width = 100
|
||||
Enabled = False
|
||||
ItemHeight = 15
|
||||
OnChange = cmb_weekordateChange
|
||||
Style = csDropDownList
|
||||
TabOrder = 1
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 88
|
||||
Width = 61
|
||||
Caption = 'Time (24hr)'
|
||||
ParentColor = False
|
||||
end
|
||||
object cmb_Daily24Hour: TComboBox
|
||||
Left = 72
|
||||
Height = 23
|
||||
Top = 88
|
||||
Width = 100
|
||||
ItemHeight = 15
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'Midnight'
|
||||
)
|
||||
OnChange = cmb_Daily24HourChange
|
||||
Style = csDropDownList
|
||||
TabOrder = 2
|
||||
Text = 'Midnight'
|
||||
end
|
||||
object cmb_SampleInterval: TComboBox
|
||||
Left = 48
|
||||
Height = 23
|
||||
Top = 128
|
||||
Width = 124
|
||||
ItemHeight = 15
|
||||
OnChange = cmb_SampleIntervalChange
|
||||
Style = csDropDownList
|
||||
TabOrder = 3
|
||||
end
|
||||
object Label4: TLabel
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 128
|
||||
Width = 39
|
||||
Caption = 'Sample'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
object LongTimer1: TLongTimer
|
||||
Enabled = False
|
||||
OnTimer = LongTimer1Timer
|
||||
OnStartTimer = LongTimer1StartTimer
|
||||
OnStopTimer = LongTimer1StopTimer
|
||||
IntervalType = lt3Monthly
|
||||
Daily24Hour = 10
|
||||
WeeklyDay = lt3Wednesday
|
||||
left = 8
|
||||
top = 8
|
||||
end
|
||||
end
|
||||
174
components/longtimer/demo/umainform.pas
Normal file
174
components/longtimer/demo/umainform.pas
Normal file
@@ -0,0 +1,174 @@
|
||||
unit umainform;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms,
|
||||
Buttons, StdCtrls, uLongTimer;
|
||||
|
||||
{ Tmainform }
|
||||
type
|
||||
Tmainform = class(TForm)
|
||||
cmb_Daily24Hour: TComboBox;
|
||||
cmb_IntervalType: TComboBox;
|
||||
cmb_weekordate: TComboBox;
|
||||
cmd_Close: TBitBtn;
|
||||
cmd_StopTimer: TButton;
|
||||
cmd_StartTimer: TButton;
|
||||
cmb_SampleInterval: TComboBox;
|
||||
crp_SetTimer: TGroupBox;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
Label4: TLabel;
|
||||
LongTimer1: TLongTimer;
|
||||
memo_ReportTimerEvent: TMemo;
|
||||
procedure cmb_SampleIntervalChange(Sender: TObject);
|
||||
procedure cmd_StopTimerClick(Sender: TObject);
|
||||
procedure cmd_StartTimerClick(Sender: TObject);
|
||||
procedure cmb_Daily24HourChange(Sender: TObject);
|
||||
procedure cmb_IntervalTypeChange(Sender: TObject);
|
||||
procedure cmb_weekordateChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure LongTimer1StartTimer(Sender: TObject);
|
||||
procedure LongTimer1StopTimer(Sender: TObject);
|
||||
procedure LongTimer1Timer(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
procedure PopulateWeekOrDate(Const i:Integer);
|
||||
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
mainform: Tmainform;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ Tmainform }
|
||||
|
||||
procedure Tmainform.LongTimer1Timer(Sender: TObject);
|
||||
begin
|
||||
// memo_ReportTimerEvent.Lines.Add('LastFired at ' + FormatDateTime('hh:nn:ss', LongTimer1.LastFired));
|
||||
memo_ReportTimerEvent.Lines.Add('Fired at ' + FormatDateTime('hh:nn:ss', Now));
|
||||
end;
|
||||
|
||||
procedure Tmainform.FormCreate(Sender: TObject);
|
||||
Var i:Integer;
|
||||
begin
|
||||
Caption:=Application.Title;
|
||||
memo_ReportTimerEvent.Clear;
|
||||
cmb_Daily24Hour.Clear;
|
||||
cmb_Daily24Hour.Items.Add('Midnight');
|
||||
For i:=1 to 23 do
|
||||
cmb_Daily24Hour.Items.Add(Format('%2.d:00',[i]));
|
||||
LongTimer1.IntervalType:=lt1Daily;
|
||||
LongTimer1.Daily24Hour:=0;
|
||||
LongTimer1.Enabled:=FALSE;
|
||||
cmb_Daily24Hour.ItemIndex:=0;
|
||||
cmb_SampleInterval.Clear;
|
||||
cmb_SampleInterval.Items.Add('Every minute');
|
||||
cmb_SampleInterval.Items.Add('Every 5 minutes');
|
||||
cmb_SampleInterval.Items.Add('Every 10 minutes');
|
||||
cmb_SampleInterval.Items.Add('Every 30 minutes');
|
||||
cmb_SampleInterval.Items.Add('Every 45 minutes');
|
||||
memo_ReportTimerEvent.Lines.Add('Timer initially disabled');
|
||||
cmb_SampleInterval.ItemIndex:=2;
|
||||
end;
|
||||
|
||||
procedure Tmainform.LongTimer1StartTimer(Sender: TObject);
|
||||
begin
|
||||
// memo_ReportTimerEvent.Lines.Add('Timer running');
|
||||
end;
|
||||
|
||||
procedure Tmainform.LongTimer1StopTimer(Sender: TObject);
|
||||
begin
|
||||
// memo_ReportTimerEvent.Lines.Add('Timer stopped');
|
||||
|
||||
end;
|
||||
|
||||
procedure Tmainform.cmd_StopTimerClick(Sender: TObject);
|
||||
begin
|
||||
LongTimer1.Enabled:=FALSE;
|
||||
memo_ReportTimerEvent.Lines.Add('Timer disabled');
|
||||
end;
|
||||
|
||||
procedure Tmainform.cmb_SampleIntervalChange(Sender: TObject);
|
||||
begin
|
||||
LongTimer1.SampleInterval:=TSampleInterval(cmb_SampleInterval.ItemIndex);
|
||||
end;
|
||||
|
||||
procedure Tmainform.cmd_StartTimerClick(Sender: TObject);
|
||||
begin
|
||||
LongTimer1.Enabled:=TRUE;
|
||||
memo_ReportTimerEvent.Lines.Add('Timer enabled');
|
||||
|
||||
end;
|
||||
|
||||
procedure Tmainform.cmb_Daily24HourChange(Sender: TObject);
|
||||
begin
|
||||
LongTimer1.Daily24Hour:=cmb_Daily24Hour.ItemIndex;
|
||||
end;
|
||||
procedure Tmainform.PopulateWeekOrDate(Const i:Integer);
|
||||
// 0=Weekly, 1=Monthly
|
||||
Var iMonthDay:Integer;
|
||||
|
||||
begin
|
||||
cmb_weekordate.Clear;
|
||||
Case i of
|
||||
0:begin
|
||||
cmb_weekordate.Items.Add('Monday');
|
||||
cmb_weekordate.Items.Add('Tuesday');
|
||||
cmb_weekordate.Items.Add('Wednesday');
|
||||
cmb_weekordate.Items.Add('Thursday');
|
||||
cmb_weekordate.Items.Add('Friday');
|
||||
cmb_weekordate.Items.Add('Saturday');
|
||||
cmb_weekordate.Items.Add('Sunday');
|
||||
end;
|
||||
1:begin
|
||||
For iMonthDay := 1 to 31 do
|
||||
cmb_weekordate.Items.Add(Format('%2.d',[iMonthDay]));
|
||||
end;
|
||||
end;
|
||||
cmb_weekordate.ItemIndex:=0;
|
||||
end;
|
||||
|
||||
procedure Tmainform.cmb_IntervalTypeChange(Sender: TObject);
|
||||
begin
|
||||
cmd_StopTimer.Click;
|
||||
Case cmb_IntervalType.ItemIndex of
|
||||
0:
|
||||
begin
|
||||
LongTimer1.IntervalType:=lt1Daily;
|
||||
cmb_weekordate.Enabled:=FALSE;
|
||||
end;
|
||||
1:
|
||||
begin
|
||||
LongTimer1.IntervalType:=lt2Weekly;
|
||||
PopulateWeekOrDate(0);
|
||||
cmb_weekordate.Enabled:=TRUE;
|
||||
end;
|
||||
2:
|
||||
begin
|
||||
LongTimer1.IntervalType:=lt3Monthly;
|
||||
PopulateWeekOrDate(1);
|
||||
cmb_weekordate.Enabled:=TRUE;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure Tmainform.cmb_weekordateChange(Sender: TObject);
|
||||
begin
|
||||
Case LongTimer1.IntervalType of
|
||||
lt2Weekly:LongTimer1.WeeklyDay:=TDay(cmb_weekordate.ItemIndex);
|
||||
lt3Monthly:LongTimer1.MonthlyDate:=(cmb_weekordate.ItemIndex+1);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user