You've already forked lazarus-ccr
TvPlanIt: Update gadgets sample project with TVpClock.Hold property.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8223 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -9,26 +9,28 @@ object Form1: TForm1
|
|||||||
ClientWidth = 473
|
ClientWidth = 473
|
||||||
Font.Color = clWindowText
|
Font.Color = clWindowText
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
LCLVersion = '2.1.0.0'
|
LCLVersion = '2.3.0.0'
|
||||||
object VpClock: TVpClock
|
object VpClock: TVpClock
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideTop.Control = Panel1
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 0
|
Left = 8
|
||||||
Height = 200
|
Height = 200
|
||||||
Top = 78
|
Top = 78
|
||||||
Width = 200
|
Width = 200
|
||||||
|
BorderSpacing.Left = 8
|
||||||
BorderSpacing.Top = 8
|
BorderSpacing.Top = 8
|
||||||
Active = False
|
Active = False
|
||||||
Color = clForm
|
Color = clForm
|
||||||
ClockMode = cmClock
|
ClockMode = cmClock
|
||||||
DigitalOptions.MilitaryTime = False
|
DigitalOptions.MilitaryTime = True
|
||||||
DigitalOptions.OnColor = clLime
|
DigitalOptions.OnColor = clLime
|
||||||
DigitalOptions.OffColor = 930866
|
DigitalOptions.OffColor = 930866
|
||||||
DigitalOptions.BgColor = clBlack
|
DigitalOptions.BgColor = clBlack
|
||||||
DigitalOptions.Size = 2
|
DigitalOptions.Size = 2
|
||||||
DigitalOptions.ShowSeconds = True
|
DigitalOptions.ShowSeconds = True
|
||||||
DisplayMode = dmAnalog
|
DisplayMode = dmAnalog
|
||||||
|
Hold = False
|
||||||
AnalogOptions.DrawMarks = True
|
AnalogOptions.DrawMarks = True
|
||||||
AnalogOptions.HourHandColor = clBlack
|
AnalogOptions.HourHandColor = clBlack
|
||||||
AnalogOptions.HourHandLength = 60
|
AnalogOptions.HourHandLength = 60
|
||||||
@ -53,10 +55,10 @@ object Form1: TForm1
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideBottom.Control = RgClockMode
|
AnchorSideBottom.Control = RgClockMode
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 336
|
Left = 342
|
||||||
Height = 51
|
Height = 25
|
||||||
Top = 194
|
Top = 203
|
||||||
Width = 99
|
Width = 98
|
||||||
Anchors = [akLeft]
|
Anchors = [akLeft]
|
||||||
BorderSpacing.Left = 16
|
BorderSpacing.Left = 16
|
||||||
BorderSpacing.Right = 16
|
BorderSpacing.Right = 16
|
||||||
@ -68,10 +70,10 @@ object Form1: TForm1
|
|||||||
AnchorSideLeft.Control = RgDisplayMode
|
AnchorSideLeft.Control = RgDisplayMode
|
||||||
AnchorSideTop.Control = RgDisplayMode
|
AnchorSideTop.Control = RgDisplayMode
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 216
|
Left = 224
|
||||||
Height = 77
|
Height = 77
|
||||||
Top = 168
|
Top = 168
|
||||||
Width = 104
|
Width = 102
|
||||||
AutoFill = True
|
AutoFill = True
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Top = 24
|
BorderSpacing.Top = 24
|
||||||
@ -84,7 +86,7 @@ object Form1: TForm1
|
|||||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
ChildSizing.ControlsPerLine = 1
|
ChildSizing.ControlsPerLine = 1
|
||||||
ClientHeight = 57
|
ClientHeight = 57
|
||||||
ClientWidth = 100
|
ClientWidth = 98
|
||||||
ItemIndex = 0
|
ItemIndex = 0
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'Clock'
|
'Clock'
|
||||||
@ -98,7 +100,7 @@ object Form1: TForm1
|
|||||||
AnchorSideLeft.Control = BtnStartStop
|
AnchorSideLeft.Control = BtnStartStop
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideTop.Control = Panel1
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 336
|
Left = 342
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 86
|
Top = 86
|
||||||
Width = 98
|
Width = 98
|
||||||
@ -113,10 +115,10 @@ object Form1: TForm1
|
|||||||
AnchorSideLeft.Control = BtnStartStop
|
AnchorSideLeft.Control = BtnStartStop
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideBottom.Control = BtnStartStop
|
AnchorSideBottom.Control = BtnStartStop
|
||||||
Left = 336
|
Left = 342
|
||||||
Height = 19
|
Height = 19
|
||||||
Top = 163
|
Top = 172
|
||||||
Width = 100
|
Width = 98
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
BorderSpacing.Top = 4
|
BorderSpacing.Top = 4
|
||||||
BorderSpacing.Right = 16
|
BorderSpacing.Right = 16
|
||||||
@ -129,7 +131,7 @@ object Form1: TForm1
|
|||||||
AnchorSideLeft.Control = RgDisplayMode
|
AnchorSideLeft.Control = RgDisplayMode
|
||||||
AnchorSideTop.Control = RgClockMode
|
AnchorSideTop.Control = RgClockMode
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 216
|
Left = 224
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 261
|
Top = 261
|
||||||
Width = 49
|
Width = 49
|
||||||
@ -143,7 +145,7 @@ object Form1: TForm1
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = Panel1
|
AnchorSideTop.Control = Panel1
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 216
|
Left = 224
|
||||||
Height = 58
|
Height = 58
|
||||||
Top = 86
|
Top = 86
|
||||||
Width = 91
|
Width = 91
|
||||||
@ -174,16 +176,18 @@ object Form1: TForm1
|
|||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideBottom.Control = BtnStartStop
|
AnchorSideBottom.Control = BtnStartStop
|
||||||
Left = 336
|
Left = 342
|
||||||
Height = 19
|
Height = 19
|
||||||
Top = 163
|
Top = 172
|
||||||
Width = 87
|
Width = 85
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akLeft, akBottom]
|
||||||
BorderSpacing.Top = 12
|
BorderSpacing.Top = 12
|
||||||
BorderSpacing.Right = 16
|
BorderSpacing.Right = 16
|
||||||
BorderSpacing.Bottom = 12
|
BorderSpacing.Bottom = 12
|
||||||
Caption = 'Military time'
|
Caption = 'Military time'
|
||||||
|
Checked = True
|
||||||
OnChange = CbMilitaryTimeChange
|
OnChange = CbMilitaryTimeChange
|
||||||
|
State = cbChecked
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
Visible = False
|
Visible = False
|
||||||
end
|
end
|
||||||
@ -191,7 +195,7 @@ object Form1: TForm1
|
|||||||
AnchorSideLeft.Control = BtnStartStop
|
AnchorSideLeft.Control = BtnStartStop
|
||||||
AnchorSideTop.Control = LblCountDownTime
|
AnchorSideTop.Control = LblCountDownTime
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 336
|
Left = 342
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 105
|
Top = 105
|
||||||
Width = 99
|
Width = 99
|
||||||
@ -225,4 +229,21 @@ object Form1: TForm1
|
|||||||
Size = 3
|
Size = 3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object BtnPauseResume: TButton
|
||||||
|
AnchorSideLeft.Control = BtnStartStop
|
||||||
|
AnchorSideTop.Control = BtnStartStop
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = BtnStartStop
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 342
|
||||||
|
Height = 25
|
||||||
|
Top = 230
|
||||||
|
Width = 98
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 2
|
||||||
|
Caption = 'Pause'
|
||||||
|
OnClick = BtnPauseResumeClick
|
||||||
|
TabOrder = 8
|
||||||
|
Visible = False
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -14,6 +14,7 @@ type
|
|||||||
|
|
||||||
TForm1 = class(TForm)
|
TForm1 = class(TForm)
|
||||||
BtnStartStop: TButton;
|
BtnStartStop: TButton;
|
||||||
|
BtnPauseResume: TButton;
|
||||||
CbNewClockFace: TCheckBox;
|
CbNewClockFace: TCheckBox;
|
||||||
CbMilitaryTime: TCheckBox;
|
CbMilitaryTime: TCheckBox;
|
||||||
EdCountDownTime: TEdit;
|
EdCountDownTime: TEdit;
|
||||||
@ -25,6 +26,7 @@ type
|
|||||||
VpClock: TVpClock;
|
VpClock: TVpClock;
|
||||||
VpLEDLabel1: TVpLEDLabel;
|
VpLEDLabel1: TVpLEDLabel;
|
||||||
procedure AnalogClockCountdownDone(Sender: TObject);
|
procedure AnalogClockCountdownDone(Sender: TObject);
|
||||||
|
procedure BtnPauseResumeClick(Sender: TObject);
|
||||||
procedure BtnStartStopClick(Sender: TObject);
|
procedure BtnStartStopClick(Sender: TObject);
|
||||||
procedure CbMilitaryTimeChange(Sender: TObject);
|
procedure CbMilitaryTimeChange(Sender: TObject);
|
||||||
procedure CbNewClockFaceChange(Sender: TObject);
|
procedure CbNewClockFaceChange(Sender: TObject);
|
||||||
@ -57,6 +59,15 @@ begin
|
|||||||
ShowMessage('Countdown finished.');
|
ShowMessage('Countdown finished.');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.BtnPauseResumeClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
VpClock.Hold := not VpClock.Hold;
|
||||||
|
if VpClock.Hold then
|
||||||
|
BtnPauseResume.Caption := 'Resume'
|
||||||
|
else
|
||||||
|
BtnPauseResume.Caption := 'Pause';
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.VpClockTimeChange(Sender: TObject);
|
procedure TForm1.VpClockTimeChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
LblElapsedTime.Caption := Format('Elapsed: %d hrs, %d min, %d sec', [
|
LblElapsedTime.Caption := Format('Elapsed: %d hrs, %d min, %d sec', [
|
||||||
@ -77,8 +88,13 @@ begin
|
|||||||
|
|
||||||
VpClock.Active := willStart;
|
VpClock.Active := willStart;
|
||||||
if VpClock.Active then
|
if VpClock.Active then
|
||||||
BtnStartStop.Caption := 'Stop' else
|
BtnStartStop.Caption := 'Stop'
|
||||||
|
else
|
||||||
BtnStartStop.Caption := 'Start';
|
BtnStartStop.Caption := 'Start';
|
||||||
|
|
||||||
|
BtnPauseResume.Caption := 'Pause';
|
||||||
|
BtnPauseResume.Visible := VpClock.Active and
|
||||||
|
(TVpClockMode(RgClockMode.ItemIndex) in [cmTimer, cmCountdownTimer])
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.CbMilitaryTimeChange(Sender: TObject);
|
procedure TForm1.CbMilitaryTimeChange(Sender: TObject);
|
||||||
@ -158,8 +174,10 @@ begin
|
|||||||
VpClock.SecondOffset := s;
|
VpClock.SecondOffset := s;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
BtnPauseResume.Hide;
|
||||||
EdCountDownTime.Visible := VpClock.ClockMode = cmCountDownTimer;
|
EdCountDownTime.Visible := VpClock.ClockMode = cmCountDownTimer;
|
||||||
LblCountDownTime.Visible := EdCountDownTime.Visible;
|
LblCountDownTime.Visible := EdCountDownTime.Visible;
|
||||||
|
VpClock.DigitalOptions.MilitaryTime := CbMilitaryTime.Checked;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.RgDisplayModeClick(Sender: TObject);
|
procedure TForm1.RgDisplayModeClick(Sender: TObject);
|
||||||
|
@ -1411,39 +1411,40 @@ var
|
|||||||
MSecond: Word;
|
MSecond: Word;
|
||||||
TimeStr: string;
|
TimeStr: string;
|
||||||
begin
|
begin
|
||||||
|
if FTime = Value then
|
||||||
|
exit;
|
||||||
|
|
||||||
DecodeTime(Value, Hour1, Minute1, Second1, MSecond);
|
DecodeTime(Value, Hour1, Minute1, Second1, MSecond);
|
||||||
DecodeTime(FTime, Hour2, Minute2, Second2, MSecond);
|
DecodeTime(FTime, Hour2, Minute2, Second2, MSecond);
|
||||||
|
|
||||||
if (Hour1 <> Hour2) or (Minute1 <> Minute2) or (Second1 <> Second2) then begin
|
FTime := Value;
|
||||||
FTime := Value;
|
|
||||||
|
|
||||||
if (Hour1 <> ckOldHour) then
|
if (Hour1 <> ckOldHour) then
|
||||||
DoOnHourChange;
|
DoOnHourChange;
|
||||||
ckOldHour := Hour1;
|
ckOldHour := Hour1;
|
||||||
if (Minute1 <> ckOldMinute) then
|
if (Minute1 <> ckOldMinute) then
|
||||||
DoOnMinuteChange;
|
DoOnMinuteChange;
|
||||||
ckOldMinute := Minute1;
|
ckOldMinute := Minute1;
|
||||||
if (Second1 <> ckOldSecond) then
|
if (Second1 <> ckOldSecond) then
|
||||||
DoOnSecondChange;
|
DoOnSecondChange;
|
||||||
ckOldSecond := Second1;
|
ckOldSecond := Second1;
|
||||||
|
|
||||||
if DisplayMode = dmDigital then begin
|
if DisplayMode = dmDigital then begin
|
||||||
if FDigitalOptions.ShowSeconds and FMilitaryTime then
|
if FDigitalOptions.ShowSeconds and FMilitaryTime then
|
||||||
TimeStr := FormatDateTime('hh:nn:ss', FTime)
|
TimeStr := FormatDateTime('hh:nn:ss', FTime)
|
||||||
else
|
else
|
||||||
if FDigitalOptions.ShowSeconds and not FMilitaryTime then
|
if FDigitalOptions.ShowSeconds and not FMilitaryTime then
|
||||||
TimeStr := FormatDateTime('hh:nn:ss am/pm', FTime)
|
TimeStr := FormatDateTime('hh:nn:ss am/pm', FTime)
|
||||||
else
|
else
|
||||||
if not FDigitalOptions.ShowSeconds and FMilitaryTime then
|
if not FDigitalOptions.ShowSeconds and FMilitaryTime then
|
||||||
TimeStr := FormatDateTime('hh:nn', FTime)
|
TimeStr := FormatDateTime('hh:nn', FTime)
|
||||||
else
|
else
|
||||||
if not FDigitalOptions.ShowSeconds and not FMilitaryTime then
|
if not FDigitalOptions.ShowSeconds and not FMilitaryTime then
|
||||||
TimeStr := FormatDateTime('hh:nn am/pm', FTime);
|
TimeStr := FormatDateTime('hh:nn am/pm', FTime);
|
||||||
ckLEDDisplay.Caption := TimeStr;
|
ckLEDDisplay.Caption := TimeStr;
|
||||||
end;
|
|
||||||
|
|
||||||
Invalidate;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user