datetimectrls: added convenient TDateTimeHidePart

This commit is contained in:
mattias 2023-01-22 14:26:14 +01:00
parent 30249915fc
commit 9cc1d1622d

View File

@ -112,10 +112,11 @@ type
TTextPart = 1..8;
TDateTimePart = (dtpDay, dtpMonth, dtpYear, dtpHour, dtpMinute,
dtpSecond, dtpMiliSec, dtpAMPM);
TDateTimeParts = set of dtpDay..dtpMiliSec; // without AMPM,
TDateTimeHidePart = dtpDay..dtpMiliSec; // without AMPM,
// because this set type is used for HideDateTimeParts property,
// where hiding of AMPM part is tied to hiding of hour (and, of
// course, it makes a difference only when TimeFormat is set to tf12)
TDateTimeParts = set of TDateTimeHidePart;
TEffectiveDateTimeParts = set of TDateTimePart;
TArrowShape = (asClassicSmaller, asClassicLarger, asModernSmaller,
@ -563,6 +564,8 @@ type
function EqualDateTime(const A, B: TDateTime): Boolean;
function IsNullDate(DT: TDateTime): Boolean;
function dbgs(const Parts: TDateTimeParts): string;
implementation
uses
@ -596,6 +599,22 @@ begin
(DT > SysUtils.MaxDateTime) or (DT < SysUtils.MinDateTime);
end;
function dbgs(const Parts: TDateTimeParts): string;
var
s: string;
Part: TDateTimePart;
begin
Result:='';
for Part:=low(TDateTimeParts) to high(TDateTimeParts) do
if Part in Parts then
begin
if Result<>'' then Result:=Result+',';
str(Part,s);
Result:=Result+s;
end;
Result:='['+Result+']';
end;
type
{ TDTUpDown }