From ed6d78b98095dd62dc20bced7a06e51cf89548e9 Mon Sep 17 00:00:00 2001 From: alexs75 Date: Mon, 13 Mar 2017 12:32:21 +0000 Subject: [PATCH] RxFPC: in RxCurrEdit add property EditFormat git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5804 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/rx/trunk/rxcontrols/rxcurredit.pas | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/components/rx/trunk/rxcontrols/rxcurredit.pas b/components/rx/trunk/rxcontrols/rxcurredit.pas index 8b424ed69..a921a2588 100644 --- a/components/rx/trunk/rxcontrols/rxcurredit.pas +++ b/components/rx/trunk/rxcontrols/rxcurredit.pas @@ -45,6 +45,7 @@ type TCustomNumEdit = class(TCustomMaskEdit) private + FEditFormat: string; FFocusedDisplay: boolean; FBeepOnError: Boolean; FCheckOnExit: Boolean; @@ -65,6 +66,7 @@ type procedure SetBeepOnError(const AValue: Boolean); procedure SetDecimalPlaces(const AValue: Cardinal); procedure SetDisplayFormat(const AValue: string); + procedure SetEditFormat(AValue: string); // procedure SetFormatOnEditing(const AValue: Boolean); procedure SetMaxValue(const AValue: Extended); procedure SetMinValue(const AValue: Extended); @@ -108,6 +110,7 @@ type property DecimalPlaces: Cardinal read FDecimalPlaces write SetDecimalPlaces default 2; property DisplayFormat: string read FDisplayFormat write SetDisplayFormat; + property EditFormat: string read FEditFormat write SetEditFormat; property MaxValue: Extended read FMaxValue write SetMaxValue; property MinValue: Extended read FMinValue write SetMinValue; // property FormatOnEditing: Boolean read FFormatOnEditing write SetFormatOnEditing default False; @@ -141,11 +144,11 @@ type property Color; property DecimalPlaces; property DisplayFormat; + property EditFormat; property DragCursor; property DragMode; property Enabled; property Font; -// property FormatOnEditing; property HideSelection; property Anchors; property BiDiMode; @@ -294,7 +297,12 @@ begin if (FValue = 0) and FZeroEmpty then Result:='' else - Result := FloatToStr(FValue); + begin + if FEditFormat <> '' then + Result := FormatFloat(FEditFormat, FValue) + else + Result := FloatToStr(FValue); + end; end; function TCustomNumEdit.GetValue: Extended; @@ -336,6 +344,13 @@ begin DataChanged; end; +procedure TCustomNumEdit.SetEditFormat(AValue: string); +begin + if FEditFormat=AValue then Exit; + FEditFormat:=AValue; + DataChanged; +end; + { procedure TCustomNumEdit.SetFormatOnEditing(const AValue: Boolean); begin