mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-06 09:58:16 +02:00
LCL/DateTimeCtrls: Add new property DecimalSeparator. Publish property Alignment in TDBDateTimePicker. Patch by Don Siders. Issue #40098.
This commit is contained in:
parent
048aa12384
commit
083a92717b
@ -178,6 +178,7 @@ type
|
|||||||
FShowMonthNames: Boolean;
|
FShowMonthNames: Boolean;
|
||||||
FTextForNullDate: TCaption;
|
FTextForNullDate: TCaption;
|
||||||
FTimeSeparator: String;
|
FTimeSeparator: String;
|
||||||
|
FDecimalSeparator: String;
|
||||||
FTimeDisplay: TTimeDisplay;
|
FTimeDisplay: TTimeDisplay;
|
||||||
FTimeFormat: TTimeFormat;
|
FTimeFormat: TTimeFormat;
|
||||||
FTrailingSeparator: Boolean;
|
FTrailingSeparator: Boolean;
|
||||||
@ -194,6 +195,7 @@ type
|
|||||||
FShowCheckBox: Boolean;
|
FShowCheckBox: Boolean;
|
||||||
FMouseInCheckBox: Boolean;
|
FMouseInCheckBox: Boolean;
|
||||||
FTimeSeparatorWidth: Integer;
|
FTimeSeparatorWidth: Integer;
|
||||||
|
FDecimalSeparatorWidth: Integer;
|
||||||
FMonthWidth: Integer;
|
FMonthWidth: Integer;
|
||||||
FNullMonthText: String;
|
FNullMonthText: String;
|
||||||
FSelectedTextPart: TTextPart;
|
FSelectedTextPart: TTextPart;
|
||||||
@ -244,6 +246,7 @@ type
|
|||||||
procedure SetCustomMonthNames(AValue: TStrings);
|
procedure SetCustomMonthNames(AValue: TStrings);
|
||||||
procedure SetDateDisplayOrder(const AValue: TDateDisplayOrder);
|
procedure SetDateDisplayOrder(const AValue: TDateDisplayOrder);
|
||||||
procedure SetDateMode(const AValue: TDTDateMode);
|
procedure SetDateMode(const AValue: TDTDateMode);
|
||||||
|
procedure SetDecimalSeparator(AValue: String);
|
||||||
procedure SetHideDateTimeParts(AValue: TDateTimeParts);
|
procedure SetHideDateTimeParts(AValue: TDateTimeParts);
|
||||||
procedure SetKind(const AValue: TDateTimeKind);
|
procedure SetKind(const AValue: TDateTimeKind);
|
||||||
procedure SetLeadingZeros(const AValue: Boolean);
|
procedure SetLeadingZeros(const AValue: Boolean);
|
||||||
@ -274,7 +277,7 @@ type
|
|||||||
procedure SetMiliSec(const AValue: Word);
|
procedure SetMiliSec(const AValue: Word);
|
||||||
procedure SetMinute(const AValue: Word);
|
procedure SetMinute(const AValue: Word);
|
||||||
procedure SetSecond(const AValue: Word);
|
procedure SetSecond(const AValue: Word);
|
||||||
procedure SetSeparators(const DateSep, TimeSep: String);
|
procedure SetSeparators(const DateSep, TimeSep, DecSep: String);
|
||||||
procedure SetDay(const AValue: Word);
|
procedure SetDay(const AValue: Word);
|
||||||
procedure SetMonth(const AValue: Word);
|
procedure SetMonth(const AValue: Word);
|
||||||
procedure SetYear(const AValue: Word);
|
procedure SetYear(const AValue: Word);
|
||||||
@ -424,6 +427,8 @@ type
|
|||||||
read FDateSeparator write SetDateSeparator stored AreSeparatorsStored;
|
read FDateSeparator write SetDateSeparator stored AreSeparatorsStored;
|
||||||
property TimeSeparator: String
|
property TimeSeparator: String
|
||||||
read FTimeSeparator write SetTimeSeparator stored AreSeparatorsStored;
|
read FTimeSeparator write SetTimeSeparator stored AreSeparatorsStored;
|
||||||
|
property DecimalSeparator: String
|
||||||
|
read FDecimalSeparator write SetDecimalSeparator stored AreSeparatorsStored;
|
||||||
property UseDefaultSeparators: Boolean
|
property UseDefaultSeparators: Boolean
|
||||||
read FUseDefaultSeparators write SetUseDefaultSeparators;
|
read FUseDefaultSeparators write SetUseDefaultSeparators;
|
||||||
property TimeFormat: TTimeFormat read FTimeFormat write SetTimeFormat;
|
property TimeFormat: TTimeFormat read FTimeFormat write SetTimeFormat;
|
||||||
@ -514,6 +519,7 @@ type
|
|||||||
property NullInputAllowed;
|
property NullInputAllowed;
|
||||||
property Kind;
|
property Kind;
|
||||||
property TimeSeparator;
|
property TimeSeparator;
|
||||||
|
property DecimalSeparator;
|
||||||
property TimeFormat;
|
property TimeFormat;
|
||||||
property TimeDisplay;
|
property TimeDisplay;
|
||||||
property DateMode;
|
property DateMode;
|
||||||
@ -1052,6 +1058,11 @@ begin
|
|||||||
UpdateShowArrowButton;
|
UpdateShowArrowButton;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomDateTimePicker.SetDecimalSeparator(AValue: String);
|
||||||
|
begin
|
||||||
|
SetSeparators(FDateSeparator, FTimeSeparator, AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomDateTimePicker.SetHideDateTimeParts(AValue: TDateTimeParts);
|
procedure TCustomDateTimePicker.SetHideDateTimeParts(AValue: TDateTimeParts);
|
||||||
begin
|
begin
|
||||||
if FHideDateTimeParts <> AValue then begin
|
if FHideDateTimeParts <> AValue then begin
|
||||||
@ -1204,7 +1215,7 @@ end;
|
|||||||
|
|
||||||
procedure TCustomDateTimePicker.SetDateSeparator(const AValue: String);
|
procedure TCustomDateTimePicker.SetDateSeparator(const AValue: String);
|
||||||
begin
|
begin
|
||||||
SetSeparators(AValue, FTimeSeparator);
|
SetSeparators(AValue, FTimeSeparator, FDecimalSeparator);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomDateTimePicker.SetMaxDate(const AValue: TDate);
|
procedure TCustomDateTimePicker.SetMaxDate(const AValue: TDate);
|
||||||
@ -1297,7 +1308,7 @@ end;
|
|||||||
|
|
||||||
procedure TCustomDateTimePicker.SetTimeSeparator(const AValue: String);
|
procedure TCustomDateTimePicker.SetTimeSeparator(const AValue: String);
|
||||||
begin
|
begin
|
||||||
SetSeparators(FDateSeparator, AValue);
|
SetSeparators(FDateSeparator, AValue, FDecimalSeparator);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomDateTimePicker.SetTimeDisplay(const AValue: TTimeDisplay);
|
procedure TCustomDateTimePicker.SetTimeDisplay(const AValue: TTimeDisplay);
|
||||||
@ -1331,7 +1342,8 @@ begin
|
|||||||
if FUseDefaultSeparators <> AValue then begin
|
if FUseDefaultSeparators <> AValue then begin
|
||||||
if AValue then begin
|
if AValue then begin
|
||||||
SetSeparators(DefaultFormatSettings.DateSeparator,
|
SetSeparators(DefaultFormatSettings.DateSeparator,
|
||||||
DefaultFormatSettings.TimeSeparator);
|
DefaultFormatSettings.TimeSeparator,
|
||||||
|
DefaultFormatSettings.DecimalSeparator);
|
||||||
// Note that here, in SetSeparators procedure,
|
// Note that here, in SetSeparators procedure,
|
||||||
// the field FUseDefaultSeparators is set to False.
|
// the field FUseDefaultSeparators is set to False.
|
||||||
end;
|
end;
|
||||||
@ -1344,8 +1356,8 @@ end;
|
|||||||
--------------------------------
|
--------------------------------
|
||||||
In this procedure we measure text and store the values in the following
|
In this procedure we measure text and store the values in the following
|
||||||
fields: FDateWidth, FTimeWidth, FTextWidth, FTextHeigth, FDigitWidth,
|
fields: FDateWidth, FTimeWidth, FTextWidth, FTextHeigth, FDigitWidth,
|
||||||
FSeparatorWidth, FTimeSeparatorWidth, FSepNoSpaceWidth. These fields are used
|
FSeparatorWidth, FTimeSeparatorWidth, FDecimalSeparatorWidth, FSepNoSpaceWidth.
|
||||||
in calculating our preffered size and when painting.
|
These fields are used in calculating our preffered size and when painting.
|
||||||
The procedure is called internally when needed (when properties which
|
The procedure is called internally when needed (when properties which
|
||||||
influence the appearence change). }
|
influence the appearence change). }
|
||||||
procedure TCustomDateTimePicker.RecalculateTextSizesIfNeeded;
|
procedure TCustomDateTimePicker.RecalculateTextSizesIfNeeded;
|
||||||
@ -1429,6 +1441,8 @@ begin
|
|||||||
FTimeWidth := 0;
|
FTimeWidth := 0;
|
||||||
FAMPMWidth := 0;
|
FAMPMWidth := 0;
|
||||||
FTimeSeparatorWidth := 0;
|
FTimeSeparatorWidth := 0;
|
||||||
|
FDecimalSeparatorWidth := 0;
|
||||||
|
|
||||||
if FKind in [dtkTime, dtkDateTime] then begin
|
if FKind in [dtkTime, dtkDateTime] then begin
|
||||||
|
|
||||||
for I := dtpHour to dtpMiliSec do
|
for I := dtpHour to dtpMiliSec do
|
||||||
@ -1444,6 +1458,8 @@ begin
|
|||||||
|
|
||||||
if TimeParts > 1 then begin
|
if TimeParts > 1 then begin
|
||||||
FTimeSeparatorWidth := Canvas.GetTextWidth(FTimeSeparator);
|
FTimeSeparatorWidth := Canvas.GetTextWidth(FTimeSeparator);
|
||||||
|
FDecimalSeparatorWidth := Canvas.GetTextWidth(FDecimalSeparator);
|
||||||
|
|
||||||
S := S + FTimeSeparator;
|
S := S + FTimeSeparator;
|
||||||
FTimeWidth := FTimeWidth + (TimeParts - 1) * FTimeSeparatorWidth;
|
FTimeWidth := FTimeWidth + (TimeParts - 1) * FTimeSeparatorWidth;
|
||||||
end;
|
end;
|
||||||
@ -1548,7 +1564,7 @@ begin
|
|||||||
SetHMSMs(HMSMs);
|
SetHMSMs(HMSMs);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomDateTimePicker.SetSeparators(const DateSep, TimeSep: String);
|
procedure TCustomDateTimePicker.SetSeparators(const DateSep, TimeSep, DecSep: String);
|
||||||
var
|
var
|
||||||
SeparatorsChanged: Boolean;
|
SeparatorsChanged: Boolean;
|
||||||
begin
|
begin
|
||||||
@ -1565,6 +1581,11 @@ begin
|
|||||||
SeparatorsChanged := True;
|
SeparatorsChanged := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if FDecimalSeparator <> DecSep then begin
|
||||||
|
FDecimalSeparator := DecSep;;
|
||||||
|
SeparatorsChanged := True;
|
||||||
|
end;
|
||||||
|
|
||||||
if SeparatorsChanged then begin
|
if SeparatorsChanged then begin
|
||||||
FRecalculatingTextSizesNeeded := True;
|
FRecalculatingTextSizesNeeded := True;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
@ -3251,10 +3272,16 @@ begin
|
|||||||
if I = K then begin
|
if I = K then begin
|
||||||
R.Right := R.Left + FDigitWidth;
|
R.Right := R.Left + FDigitWidth;
|
||||||
end else if I < K then begin
|
end else if I < K then begin
|
||||||
|
if I = Ord(dtpMiliSec) then begin
|
||||||
|
R.Right := R.Left + FDecimalSeparatorWidth;
|
||||||
|
Canvas.TextRect(R, R.Left, R.Top, FDecimalSeparator, TextStyle);
|
||||||
|
end else begin
|
||||||
R.Right := R.Left + FTimeSeparatorWidth;
|
R.Right := R.Left + FTimeSeparatorWidth;
|
||||||
Canvas.TextRect(R, R.Left, R.Top, FTimeSeparator, TextStyle);
|
Canvas.TextRect(R, R.Left, R.Top, FTimeSeparator, TextStyle);
|
||||||
end;
|
end;
|
||||||
end else begin
|
end;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
if FTrailingSeparator then begin
|
if FTrailingSeparator then begin
|
||||||
R.Right := R.Left + FSepNoSpaceWidth;
|
R.Right := R.Left + FSepNoSpaceWidth;
|
||||||
Canvas.TextRect(R, R.Left, R.Top,
|
Canvas.TextRect(R, R.Left, R.Top,
|
||||||
@ -4096,6 +4123,7 @@ begin
|
|||||||
FUseDefaultSeparators := True;
|
FUseDefaultSeparators := True;
|
||||||
FDateSeparator := DefaultFormatSettings.DateSeparator;
|
FDateSeparator := DefaultFormatSettings.DateSeparator;
|
||||||
FTimeSeparator := DefaultFormatSettings.TimeSeparator;
|
FTimeSeparator := DefaultFormatSettings.TimeSeparator;
|
||||||
|
FDecimalSeparator := DefaultFormatSettings.DecimalSeparator;
|
||||||
FEffectiveCenturyFrom := FCenturyFrom;
|
FEffectiveCenturyFrom := FCenturyFrom;
|
||||||
FJumpMinMax := False;
|
FJumpMinMax := False;
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ type
|
|||||||
property ShowHint;
|
property ShowHint;
|
||||||
property ParentShowHint;
|
property ParentShowHint;
|
||||||
property Align;
|
property Align;
|
||||||
|
property Alignment;
|
||||||
property Anchors;
|
property Anchors;
|
||||||
property Constraints;
|
property Constraints;
|
||||||
property Cursor;
|
property Cursor;
|
||||||
@ -103,6 +104,7 @@ type
|
|||||||
property NullInputAllowed;
|
property NullInputAllowed;
|
||||||
property Kind;
|
property Kind;
|
||||||
property TimeSeparator;
|
property TimeSeparator;
|
||||||
|
property DecimalSeparator;
|
||||||
property TimeFormat;
|
property TimeFormat;
|
||||||
property TimeDisplay;
|
property TimeDisplay;
|
||||||
property DateMode;
|
property DateMode;
|
||||||
|
Loading…
Reference in New Issue
Block a user