mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-08 21:39:31 +01:00
datetimectrls: TDateTimePicker: add AutoCheck property
git-svn-id: trunk@53805 -
This commit is contained in:
parent
feccd7b7df
commit
610efc232b
@ -188,6 +188,7 @@ type
|
|||||||
FCorrectedDTP: TDateTimePart;
|
FCorrectedDTP: TDateTimePart;
|
||||||
FCorrectedValue: Word;
|
FCorrectedValue: Word;
|
||||||
FEnableWhenUnchecked: Boolean;
|
FEnableWhenUnchecked: Boolean;
|
||||||
|
FAutoCheck: Boolean;
|
||||||
|
|
||||||
function AreSeparatorsStored: Boolean;
|
function AreSeparatorsStored: Boolean;
|
||||||
function GetChecked: Boolean;
|
function GetChecked: Boolean;
|
||||||
@ -335,6 +336,7 @@ type
|
|||||||
procedure Change; virtual;
|
procedure Change; virtual;
|
||||||
procedure DoDropDown; virtual;
|
procedure DoDropDown; virtual;
|
||||||
procedure DoCloseUp; virtual;
|
procedure DoCloseUp; virtual;
|
||||||
|
procedure DoAutoCheck; virtual;
|
||||||
|
|
||||||
property BorderStyle default bsSingle;
|
property BorderStyle default bsSingle;
|
||||||
property AutoSize default True;
|
property AutoSize default True;
|
||||||
@ -362,6 +364,7 @@ type
|
|||||||
read FOnCheckBoxChange write FOnCheckBoxChange;
|
read FOnCheckBoxChange write FOnCheckBoxChange;
|
||||||
property OnDropDown: TNotifyEvent read FOnDropDown write FOnDropDown;
|
property OnDropDown: TNotifyEvent read FOnDropDown write FOnDropDown;
|
||||||
property OnCloseUp: TNotifyEvent read FOnCloseUp write FOnCloseUp;
|
property OnCloseUp: TNotifyEvent read FOnCloseUp write FOnCloseUp;
|
||||||
|
property AutoCheck: Boolean read FAutoCheck write FAutoCheck default True;
|
||||||
property ShowCheckBox: Boolean
|
property ShowCheckBox: Boolean
|
||||||
read GetShowCheckBox write SetShowCheckBox default False;
|
read GetShowCheckBox write SetShowCheckBox default False;
|
||||||
property Checked: Boolean read GetChecked write SetChecked default True;
|
property Checked: Boolean read GetChecked write SetChecked default True;
|
||||||
@ -420,6 +423,7 @@ type
|
|||||||
property DroppedDown;
|
property DroppedDown;
|
||||||
published
|
published
|
||||||
property ArrowShape;
|
property ArrowShape;
|
||||||
|
property AutoCheck;
|
||||||
property ShowCheckBox;
|
property ShowCheckBox;
|
||||||
property Checked;
|
property Checked;
|
||||||
property CenturyFrom;
|
property CenturyFrom;
|
||||||
@ -683,8 +687,7 @@ begin
|
|||||||
// we'll change the date, but keep the time:
|
// we'll change the date, but keep the time:
|
||||||
DTPicker.SetDateTime(ComposeDateTime(Cal.GetDate, DTPicker.DateTime));
|
DTPicker.SetDateTime(ComposeDateTime(Cal.GetDate, DTPicker.DateTime));
|
||||||
end;
|
end;
|
||||||
if DTPicker.ShowCheckBox and not DTPicker.Checked then
|
DTPicker.DoAutoCheck;
|
||||||
DTPicker.Checked := True;
|
|
||||||
finally
|
finally
|
||||||
Dec(DTPicker.FUserChanging);
|
Dec(DTPicker.FUserChanging);
|
||||||
end;
|
end;
|
||||||
@ -2016,14 +2019,20 @@ begin
|
|||||||
Key := 0;
|
Key := 0;
|
||||||
UpdateIfUserChangedText;
|
UpdateIfUserChangedText;
|
||||||
if not FReadOnly then
|
if not FReadOnly then
|
||||||
|
begin
|
||||||
IncreaseCurrentTextPart;
|
IncreaseCurrentTextPart;
|
||||||
|
DoAutoCheck;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
VK_DOWN:
|
VK_DOWN:
|
||||||
begin
|
begin
|
||||||
Key := 0;
|
Key := 0;
|
||||||
UpdateIfUserChangedText;
|
UpdateIfUserChangedText;
|
||||||
if not FReadOnly then
|
if not FReadOnly then
|
||||||
|
begin
|
||||||
DecreaseCurrentTextPart;
|
DecreaseCurrentTextPart;
|
||||||
|
DoAutoCheck;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
VK_RETURN:
|
VK_RETURN:
|
||||||
if not FReadOnly then
|
if not FReadOnly then
|
||||||
@ -2214,6 +2223,7 @@ begin
|
|||||||
end else
|
end else
|
||||||
Invalidate;
|
Invalidate;
|
||||||
|
|
||||||
|
DoAutoCheck;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
@ -2888,8 +2898,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomDateTimePicker.SendExternalKey(const aKey: Char);
|
procedure TCustomDateTimePicker.SendExternalKey(const aKey: Char);
|
||||||
var
|
|
||||||
SPart: TTextPart;
|
|
||||||
begin
|
begin
|
||||||
if not(aKey in ['0'..'9']) then
|
if not(aKey in ['0'..'9']) then
|
||||||
Exit;
|
Exit;
|
||||||
@ -2898,11 +2906,13 @@ begin
|
|||||||
begin
|
begin
|
||||||
FTextPart[FSelectedTextPart] := aKey;
|
FTextPart[FSelectedTextPart] := aKey;
|
||||||
FUserChangedText := True;
|
FUserChangedText := True;
|
||||||
|
DoAutoCheck;
|
||||||
end else
|
end else
|
||||||
if FSelectedTextPart in [4..8] then
|
if FSelectedTextPart in [4..8] then
|
||||||
begin
|
begin
|
||||||
FTimeText[TDateTimePart(FSelectedTextPart-1)] := aKey;
|
FTimeText[TDateTimePart(FSelectedTextPart-1)] := aKey;
|
||||||
FUserChangedText := True;
|
FUserChangedText := True;
|
||||||
|
DoAutoCheck;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3723,6 +3733,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomDateTimePicker.DoAutoCheck;
|
||||||
|
begin
|
||||||
|
if ShowCheckBox and not Checked and AutoCheck then
|
||||||
|
Checked := True;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomDateTimePicker.DestroyArrowBtn;
|
procedure TCustomDateTimePicker.DestroyArrowBtn;
|
||||||
begin
|
begin
|
||||||
if Assigned(FArrowButton) then begin
|
if Assigned(FArrowButton) then begin
|
||||||
@ -3742,6 +3758,7 @@ begin
|
|||||||
with GetControlClassDefaultSize do
|
with GetControlClassDefaultSize do
|
||||||
SetInitialBounds(0, 0, cx, cy);
|
SetInitialBounds(0, 0, cx, cy);
|
||||||
|
|
||||||
|
FAutoCheck := True;
|
||||||
FCalAlignment := dtaDefault;
|
FCalAlignment := dtaDefault;
|
||||||
FCorrectedDTP := dtpAMPM;
|
FCorrectedDTP := dtpAMPM;
|
||||||
FCorrectedValue := 0;
|
FCorrectedValue := 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user