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
This commit is contained in:
alexs75
2013-03-17 08:06:32 +00:00
parent 41fbf0e16c
commit 8420f0cbf1
6 changed files with 32 additions and 16 deletions

View File

@@ -149,12 +149,12 @@ type
property Enabled; property Enabled;
property Font; property Font;
property FormatOnEditing; property FormatOnEditing;
// property HideSelection; property HideSelection;
property Anchors; property Anchors;
// property BiDiMode; property BiDiMode;
property Constraints; property Constraints;
property DragKind; property DragKind;
// property ParentBiDiMode; property ParentBiDiMode;
{$IFDEF WIN32} {$IFDEF WIN32}
{$IFNDEF VER90} {$IFNDEF VER90}
// property ImeMode; // property ImeMode;
@@ -190,20 +190,15 @@ type
property OnMouseDown; property OnMouseDown;
property OnMouseMove; property OnMouseMove;
property OnMouseUp; property OnMouseUp;
{$IFDEF RX_D5}
property OnContextPopup; property OnContextPopup;
{$ENDIF}
{$IFDEF WIN32}
property OnStartDrag; property OnStartDrag;
{$ENDIF}
{$IFDEF RX_D4}
property OnEndDock; property OnEndDock;
property OnStartDock; property OnStartDock;
{$ENDIF}
end; end;
implementation implementation
uses {rxstrutils, } strutils, Math, tooledit; uses {rxstrutils, } strutils, Math, tooledit, rxconst;
function IsValidFloat(const Value: string; var RetValue: Extended): Boolean; function IsValidFloat(const Value: string; var RetValue: Extended): Boolean;
var var
@@ -285,8 +280,8 @@ begin
FDisplayFormat := DefaultDisplayFormat; FDisplayFormat := DefaultDisplayFormat;
FDecimalPlaces := 2; FDecimalPlaces := 2;
FZeroEmpty := True; FZeroEmpty := True;
// inherited Text := ''; inherited Text := '';
// inherited Alignment := taLeftJustify; inherited Alignment := taLeftJustify;
// FDefNumGlyphs := 2; // FDefNumGlyphs := 2;
{ forces update } { forces update }
DataChanged; DataChanged;
@@ -449,7 +444,7 @@ begin
end; end;
end; end;
if RaiseOnError and (Result <> NewValue) then 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]); [DecimalPlaces, FMinValue, DecimalPlaces, FMaxValue]);
end; end;
end; end;
@@ -631,11 +626,13 @@ begin
if Key in ['.', ','] - [ThousandSeparator] then if Key in ['.', ','] - [ThousandSeparator] then
Key := DecimalSeparator; Key := DecimalSeparator;
inherited KeyPress(Key); 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); // if BeepOnError then MessageBeep(0);
Key := #0; Key := #0;
end end
else if Key = #27 then begin else
if Key = #27 then begin
Reset; Reset;
Key := #0; Key := #0;
end; end;
@@ -663,6 +660,9 @@ begin
DecPos := Length(S) - DecPos; DecPos := Length(S) - DecPos;
if DecPos > Integer(FDecimalPlaces) then if DecPos > Integer(FDecimalPlaces) then
Exit; Exit;
if S[1] = DecimalSeparator then
s := '0' + s;
end; end;
Result := IsValidFloat(S, RetValue); Result := IsValidFloat(S, RetValue);
if Result and (FMinValue >= 0) and (FMaxValue > 0) and (RetValue < 0) then if Result and (FMinValue >= 0) and (FMaxValue > 0) and (RetValue < 0) then

View File

@@ -149,6 +149,10 @@ msgstr "Opciones"
msgid "Other gui" msgid "Other gui"
msgstr "" msgstr ""
#: rxconst.soutofrange
msgid "Out of range %d %d %d %d"
msgstr ""
#: rxconst.sprevmonth #: rxconst.sprevmonth
msgid "Previous Month|" msgid "Previous Month|"
msgstr "Anterior Mes|" msgstr "Anterior Mes|"

View File

@@ -149,6 +149,10 @@ msgstr ""
msgid "Other gui" msgid "Other gui"
msgstr "" msgstr ""
#: rxconst.soutofrange
msgid "Out of range %d %d %d %d"
msgstr ""
#: rxconst.sprevmonth #: rxconst.sprevmonth
msgid "Previous Month|" msgid "Previous Month|"
msgstr "" msgstr ""

View File

@@ -149,6 +149,10 @@ msgstr "Параметры"
msgid "Other gui" msgid "Other gui"
msgstr "Неизвестный графический интерфейс" msgstr "Неизвестный графический интерфейс"
#: rxconst.soutofrange
msgid "Out of range %d %d %d %d"
msgstr ""
#: rxconst.sprevmonth #: rxconst.sprevmonth
msgid "Previous Month|" msgid "Previous Month|"
msgstr "Превыдущий месяц|" msgstr "Превыдущий месяц|"

View File

@@ -158,6 +158,10 @@ msgstr "Параметри"
msgid "Other gui" msgid "Other gui"
msgstr "Інші GUI" msgstr "Інші GUI"
#: rxconst.soutofrange
msgid "Out of range %d %d %d %d"
msgstr ""
#: rxconst.sprevmonth #: rxconst.sprevmonth
msgid "Previous Month|" msgid "Previous Month|"
msgstr "Попередній місяць|" msgstr "Попередній місяць|"

View File

@@ -113,7 +113,7 @@ resourcestring
sAbout = 'About'; sAbout = 'About';
sGeneral = 'General'; sGeneral = 'General';
sLicense = 'License'; sLicense = 'License';
SOutOfRange = 'Out of range %d %d %d %d';
{ TRxHistoryNavigator } { TRxHistoryNavigator }
sHistoryDesc = 'History - "%s"'; sHistoryDesc = 'History - "%s"';