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