From 8420f0cbf1c098ae7419942877c23197a2cd08e0 Mon Sep 17 00:00:00 2001 From: alexs75 Date: Sun, 17 Mar 2013 08:06:32 +0000 Subject: [PATCH] RX:TCurrencyEdit - applied patch from Adilson Pazzini git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2704 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/rx/curredit.pas | 30 +++++++++++++-------------- components/rx/languages/rxconst.es.po | 4 ++++ components/rx/languages/rxconst.po | 4 ++++ components/rx/languages/rxconst.ru.po | 4 ++++ components/rx/languages/rxconst.uk.po | 4 ++++ components/rx/rxconst.pas | 2 +- 6 files changed, 32 insertions(+), 16 deletions(-) diff --git a/components/rx/curredit.pas b/components/rx/curredit.pas index e43aac3a2..d7244a927 100644 --- a/components/rx/curredit.pas +++ b/components/rx/curredit.pas @@ -149,12 +149,12 @@ type property Enabled; property Font; property FormatOnEditing; -// property HideSelection; + property HideSelection; property Anchors; -// property BiDiMode; + property BiDiMode; property Constraints; property DragKind; -// property ParentBiDiMode; + property ParentBiDiMode; {$IFDEF WIN32} {$IFNDEF VER90} // property ImeMode; @@ -190,20 +190,15 @@ type property OnMouseDown; property OnMouseMove; property OnMouseUp; -{$IFDEF RX_D5} + property OnContextPopup; -{$ENDIF} -{$IFDEF WIN32} property OnStartDrag; -{$ENDIF} -{$IFDEF RX_D4} property OnEndDock; property OnStartDock; -{$ENDIF} end; implementation -uses {rxstrutils, } strutils, Math, tooledit; +uses {rxstrutils, } strutils, Math, tooledit, rxconst; function IsValidFloat(const Value: string; var RetValue: Extended): Boolean; var @@ -285,8 +280,8 @@ begin FDisplayFormat := DefaultDisplayFormat; FDecimalPlaces := 2; FZeroEmpty := True; -// inherited Text := ''; -// inherited Alignment := taLeftJustify; + inherited Text := ''; + inherited Alignment := taLeftJustify; // FDefNumGlyphs := 2; { forces update } DataChanged; @@ -449,7 +444,7 @@ begin end; end; if RaiseOnError and (Result <> NewValue) then - raise ERangeError.CreateFmt(StringReplace('SOutOfRange %d %d %d %d', '%d', '%.*f', [rfReplaceAll]), + raise ERangeError.CreateFmt(StringReplace(SOutOfRange, '%d', '%.*f', [rfReplaceAll]), [DecimalPlaces, FMinValue, DecimalPlaces, FMaxValue]); end; end; @@ -631,11 +626,13 @@ begin if Key in ['.', ','] - [ThousandSeparator] then Key := DecimalSeparator; inherited KeyPress(Key); - if (Key in [#32..#255]) and not IsValidChar(Key) then begin + if (Key in [#32..#255]) and not IsValidChar(Key) then + begin // if BeepOnError then MessageBeep(0); Key := #0; end - else if Key = #27 then begin + else + if Key = #27 then begin Reset; Key := #0; end; @@ -663,6 +660,9 @@ begin DecPos := Length(S) - DecPos; if DecPos > Integer(FDecimalPlaces) then Exit; + + if S[1] = DecimalSeparator then + s := '0' + s; end; Result := IsValidFloat(S, RetValue); if Result and (FMinValue >= 0) and (FMaxValue > 0) and (RetValue < 0) then diff --git a/components/rx/languages/rxconst.es.po b/components/rx/languages/rxconst.es.po index 631a5f2b7..eda3c0031 100644 --- a/components/rx/languages/rxconst.es.po +++ b/components/rx/languages/rxconst.es.po @@ -149,6 +149,10 @@ msgstr "Opciones" msgid "Other gui" msgstr "" +#: rxconst.soutofrange +msgid "Out of range %d %d %d %d" +msgstr "" + #: rxconst.sprevmonth msgid "Previous Month|" msgstr "Anterior Mes|" diff --git a/components/rx/languages/rxconst.po b/components/rx/languages/rxconst.po index 34483f959..1b08f30c0 100644 --- a/components/rx/languages/rxconst.po +++ b/components/rx/languages/rxconst.po @@ -149,6 +149,10 @@ msgstr "" msgid "Other gui" msgstr "" +#: rxconst.soutofrange +msgid "Out of range %d %d %d %d" +msgstr "" + #: rxconst.sprevmonth msgid "Previous Month|" msgstr "" diff --git a/components/rx/languages/rxconst.ru.po b/components/rx/languages/rxconst.ru.po index 0b8ea4f33..37caadd59 100644 --- a/components/rx/languages/rxconst.ru.po +++ b/components/rx/languages/rxconst.ru.po @@ -149,6 +149,10 @@ msgstr "Параметры" msgid "Other gui" msgstr "Неизвестный графический интерфейс" +#: rxconst.soutofrange +msgid "Out of range %d %d %d %d" +msgstr "" + #: rxconst.sprevmonth msgid "Previous Month|" msgstr "Превыдущий месяц|" diff --git a/components/rx/languages/rxconst.uk.po b/components/rx/languages/rxconst.uk.po index 2d2c53ff5..e123d618c 100644 --- a/components/rx/languages/rxconst.uk.po +++ b/components/rx/languages/rxconst.uk.po @@ -158,6 +158,10 @@ msgstr "Параметри" msgid "Other gui" msgstr "Інші GUI" +#: rxconst.soutofrange +msgid "Out of range %d %d %d %d" +msgstr "" + #: rxconst.sprevmonth msgid "Previous Month|" msgstr "Попередній місяць|" diff --git a/components/rx/rxconst.pas b/components/rx/rxconst.pas index dec6c5ec7..a1e5cb9c3 100644 --- a/components/rx/rxconst.pas +++ b/components/rx/rxconst.pas @@ -113,7 +113,7 @@ resourcestring sAbout = 'About'; sGeneral = 'General'; sLicense = 'License'; - + SOutOfRange = 'Out of range %d %d %d %d'; { TRxHistoryNavigator } sHistoryDesc = 'History - "%s"';