mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 10:16:00 +02:00
datetimectrls: datetimepicker: add EnableIfUnchecked property
git-svn-id: trunk@53760 -
This commit is contained in:
parent
33449c9e87
commit
b8082b8827
@ -187,6 +187,7 @@ type
|
|||||||
FChangeInRecursiveCall: Boolean;
|
FChangeInRecursiveCall: Boolean;
|
||||||
FCorrectedDTP: TDateTimePart;
|
FCorrectedDTP: TDateTimePart;
|
||||||
FCorrectedValue: Word;
|
FCorrectedValue: Word;
|
||||||
|
FEnableWhenUnchecked: Boolean;
|
||||||
|
|
||||||
function AreSeparatorsStored: Boolean;
|
function AreSeparatorsStored: Boolean;
|
||||||
function GetChecked: Boolean;
|
function GetChecked: Boolean;
|
||||||
@ -248,6 +249,7 @@ type
|
|||||||
procedure SetYear(const AValue: Word);
|
procedure SetYear(const AValue: Word);
|
||||||
procedure SetYYYYMMDD(const AValue: TYMD);
|
procedure SetYYYYMMDD(const AValue: TYMD);
|
||||||
procedure SetHMSMs(const AValue: THMSMs);
|
procedure SetHMSMs(const AValue: THMSMs);
|
||||||
|
procedure SetEnableWhenUnchecked(const AEnableWhenUnchecked: Boolean);
|
||||||
procedure UpdateIfUserChangedText;
|
procedure UpdateIfUserChangedText;
|
||||||
function GetSelectedText: String;
|
function GetSelectedText: String;
|
||||||
procedure AdjustSelection;
|
procedure AdjustSelection;
|
||||||
@ -393,7 +395,7 @@ type
|
|||||||
property DroppedDown: Boolean read GetDroppedDown;
|
property DroppedDown: Boolean read GetDroppedDown;
|
||||||
property CalAlignment: TDTCalAlignment read FCalAlignment write SetCalAlignment default dtaDefault;
|
property CalAlignment: TDTCalAlignment read FCalAlignment write SetCalAlignment default dtaDefault;
|
||||||
property FlatButton: Boolean read GetFlatButton write SetFlatButton default False;
|
property FlatButton: Boolean read GetFlatButton write SetFlatButton default False;
|
||||||
|
property EnableWhenUnchecked: Boolean read FEnableWhenUnchecked write SetEnableWhenUnchecked default False;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -465,6 +467,7 @@ type
|
|||||||
property ShowMonthNames;
|
property ShowMonthNames;
|
||||||
property CalAlignment;
|
property CalAlignment;
|
||||||
property FlatButton;
|
property FlatButton;
|
||||||
|
property EnableWhenUnchecked;
|
||||||
// events:
|
// events:
|
||||||
property OnChange;
|
property OnChange;
|
||||||
property OnCheckBoxChange;
|
property OnCheckBoxChange;
|
||||||
@ -679,6 +682,8 @@ 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.Checked := True;
|
||||||
finally
|
finally
|
||||||
Dec(DTPicker.FUserChanging);
|
Dec(DTPicker.FUserChanging);
|
||||||
end;
|
end;
|
||||||
@ -893,7 +898,7 @@ end;
|
|||||||
|
|
||||||
procedure TCustomDateTimePicker.CheckTextEnabled;
|
procedure TCustomDateTimePicker.CheckTextEnabled;
|
||||||
begin
|
begin
|
||||||
FTextEnabled := Self.Enabled and GetChecked;
|
FTextEnabled := Self.Enabled and (FEnableWhenUnchecked or GetChecked);
|
||||||
|
|
||||||
if Assigned(FArrowButton) then
|
if Assigned(FArrowButton) then
|
||||||
FArrowButton.Enabled := FTextEnabled;
|
FArrowButton.Enabled := FTextEnabled;
|
||||||
@ -2915,6 +2920,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomDateTimePicker.SetEnableWhenUnchecked(
|
||||||
|
const AEnableWhenUnchecked: Boolean);
|
||||||
|
begin
|
||||||
|
if FEnableWhenUnchecked = AEnableWhenUnchecked then Exit;
|
||||||
|
FEnableWhenUnchecked := AEnableWhenUnchecked;
|
||||||
|
|
||||||
|
CheckTextEnabled;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomDateTimePicker.SetFlatButton(const AValue: Boolean);
|
procedure TCustomDateTimePicker.SetFlatButton(const AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
if FlatButton=AValue then
|
if FlatButton=AValue then
|
||||||
|
Loading…
Reference in New Issue
Block a user