mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 00:20:24 +02:00
LCL/TTimeEdit: New properties TimeAMString and TimePMString to allow specifying also the AM/PM string used by TTimeEdit.
This commit is contained in:
parent
5e3b6bce5d
commit
d6b0e5c07d
@ -726,15 +726,18 @@ type
|
||||
FDefaultNow: Boolean;
|
||||
FDroppedDown: Boolean;
|
||||
FSimpleLayout: Boolean;
|
||||
FTimeAMPMString: array[0..1] of String;
|
||||
FTimeFormat: String;
|
||||
FTimeSeparator: String;
|
||||
FOnAcceptTime: TAcceptTimeEvent;
|
||||
FOnCustomTime: TCustomTimeEvent;
|
||||
function GetTime: TDateTime;
|
||||
function GetTimeAMPMString(AIndex: Integer): String;
|
||||
procedure SetTime(AValue: TDateTime);
|
||||
procedure SetEmptyTime;
|
||||
function GetLayout: Boolean;
|
||||
procedure SetLayout(AValue: Boolean);
|
||||
procedure SetTimeAMPMString(AIndex: Integer; AValue: String);
|
||||
procedure SetTimeFormat(AValue: String);
|
||||
procedure SetTimeSeparator(AValue: String);
|
||||
procedure TimePopupReturnTime(Sender: TObject; const ATime: TDateTime);
|
||||
@ -801,8 +804,10 @@ type
|
||||
property Spacing;
|
||||
property TabStop;
|
||||
property TabOrder;
|
||||
property TimeAMString: String index 0 read GetTimeAMPMString write SetTimeAMPMString;
|
||||
property TimeFormat: String read FTimeFormat write SetTimeFormat;
|
||||
property TimeSeparator: String read FTimeSeparator write SetTimeSeparator;
|
||||
property TimePMString: String index 1 read GetTimeAMPMString write SetTimeAMPMString;
|
||||
property Visible;
|
||||
property Text;
|
||||
property TextHint;
|
||||
@ -2214,6 +2219,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TTimeEdit.GetTimeAMPMString(AIndex: Integer): String;
|
||||
begin
|
||||
Result := FTimeAMPMString[AIndex];
|
||||
end;
|
||||
|
||||
function TTimeEdit.GetLayout: Boolean;
|
||||
begin
|
||||
Result := FSimpleLayout;
|
||||
@ -2231,6 +2241,15 @@ begin
|
||||
IsEmptyTime := False;
|
||||
end;
|
||||
|
||||
procedure TTimeEdit.SetTimeAMPMString(AIndex: Integer; AValue: String);
|
||||
begin
|
||||
if FTimeAMPMString[AIndex] <> AValue then
|
||||
begin
|
||||
FTimeAMPMString[AIndex] := AValue;
|
||||
SetTime(FTime);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTimeEdit.SetTimeFormat(AValue: String);
|
||||
begin
|
||||
if (FTimeFormat <> AValue) and ValidTimeFormat(AValue) then
|
||||
@ -2327,11 +2346,13 @@ begin
|
||||
Result := DefaultFormatSettings;
|
||||
Result.TimeSeparator := UsedTimeSeparator;
|
||||
Result.ShortTimeFormat := UsedTimeFormat;
|
||||
Result.TimeAMString := TimeAMString;
|
||||
Result.TimePMString := TimePMString;
|
||||
end;
|
||||
|
||||
function TTimeEdit.UsedTimeFormat: String;
|
||||
begin
|
||||
if FTimeFormat = '' then
|
||||
if (FTimeFormat = '') or (FTimeFormat = 't') then
|
||||
Result := DefaultFormatSettings.ShortTimeFormat
|
||||
else
|
||||
Result := FTimeFormat;
|
||||
@ -2385,6 +2406,7 @@ begin
|
||||
begin
|
||||
Include(parts, pM);
|
||||
if (pN in parts) then exit; // mixing of 'n' and 'm' not valid
|
||||
if parts = [pM] then exit; // isolated 'm' not allowed
|
||||
if parts * [pH, pM, pS] = [pM, pS] then exit; // m:s not valid
|
||||
if parts * [pH, pM, pS, pZ] = [pM, pZ] then exit; // m.z not valid
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user