diff --git a/components/jujiboutils/jujibo-utils/jujibocontrols.lpk b/components/jujiboutils/jujibo-utils/jujibocontrols.lpk index 5473ec930..e198611cc 100644 --- a/components/jujiboutils/jujibo-utils/jujibocontrols.lpk +++ b/components/jujiboutils/jujibo-utils/jujibocontrols.lpk @@ -18,7 +18,7 @@ - + @@ -157,6 +157,10 @@ + + + + diff --git a/components/jujiboutils/jujibo-utils/jujibocontrols.pas b/components/jujiboutils/jujibo-utils/jujibocontrols.pas index 4abbe074c..1867978ab 100644 --- a/components/jujiboutils/jujibo-utils/jujibocontrols.pas +++ b/components/jujiboutils/jujibo-utils/jujibocontrols.pas @@ -13,7 +13,8 @@ uses JDateEdit, JLabeledDateEdit, JDBGridControl, jdbgridutils, JDBLabeledEdit, JTimeEdit, JLabeledTimeEdit, JDBTimeEdit, JDBLabeledTimeEdit, JDateTimeEdit, JLabeledDateTimeEdit, JDBDateTimeEdit, JDBLabeledDateTimeEdit, JFloatEdit, - JLabeledFloatEdit, JDBFloatEdit, JDBLabeledFloatEdit, LazarusPackageIntf; + JLabeledFloatEdit, JDBFloatEdit, JDBLabeledFloatEdit, jinputconsts, + LazarusPackageIntf; implementation diff --git a/components/jujiboutils/jujibo-utils/src/jcurrencyedit.pas b/components/jujiboutils/jujibo-utils/src/jcurrencyedit.pas index 37cc68b06..109241b1a 100644 --- a/components/jujiboutils/jujibo-utils/src/jcurrencyedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jcurrencyedit.pas @@ -22,7 +22,8 @@ unit JCurrencyEdit; interface uses - Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, Dialogs; + Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, + Dialogs, jinputconsts; type @@ -194,7 +195,7 @@ begin theValue := StrToCurr(Text) else begin - ShowMessage(Text + ' no es un valor válido'); + ShowMessage(Format(SInvalidNumber, [Text])); SetFocus; end; if fDecimals > 0 then diff --git a/components/jujiboutils/jujibo-utils/src/jdateedit.pas b/components/jujiboutils/jujibo-utils/src/jdateedit.pas index 4fb105bf1..d7803d8e0 100644 --- a/components/jujiboutils/jujibo-utils/src/jdateedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdateedit.pas @@ -23,7 +23,7 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, - Dialogs, jcontrolutils; + Dialogs, jcontrolutils, jinputconsts; type @@ -167,7 +167,7 @@ begin theValue := StrToDate(Text) else begin - ShowMessage(Text + ' no es una fecha válida'); + ShowMessage(Format(SInvalidDate, [Text])); SetFocus; end; formatInput; diff --git a/components/jujiboutils/jujibo-utils/src/jdatetimeedit.pas b/components/jujiboutils/jujibo-utils/src/jdatetimeedit.pas index 49ace2458..8cd36cf62 100644 --- a/components/jujiboutils/jujibo-utils/src/jdatetimeedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdatetimeedit.pas @@ -24,7 +24,7 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, - Dialogs, jcontrolutils; + Dialogs, jcontrolutils, jinputconsts; type TJDateTimeEdit = class(TCustomEdit) @@ -161,7 +161,7 @@ begin Text := NormalizeDateTime(Text, theValue); if (Length(bufText) > 0) and (Length(Text) = 0) then begin - ShowMessage(bufText + ' no es una fecha-hora válida'); + ShowMessage(Format(SInvalidDateTime, [bufText])); SetFocus; end else @@ -172,7 +172,7 @@ begin theValue := StrToDateTime(Text) else begin - ShowMessage(Text + ' no es una fecha-hora válida'); + ShowMessage(Format(SInvalidDateTime, [Text])); SetFocus; end; formatInput; diff --git a/components/jujiboutils/jujibo-utils/src/jdbcurrencyedit.pas b/components/jujiboutils/jujibo-utils/src/jdbcurrencyedit.pas index 93175d08b..d0ce32d40 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbcurrencyedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbcurrencyedit.pas @@ -23,7 +23,7 @@ interface uses Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, - SysUtils; + SysUtils,jinputconsts; type @@ -192,7 +192,7 @@ begin begin if FDataLink.Field <> nil then begin - ShowMessage(Caption + ' no es un valor válido'); + ShowMessage(Format(SInvalidNumber, [Caption])); Caption := FDataLink.Field.AsString; SelectAll; SetFocus; diff --git a/components/jujiboutils/jujibo-utils/src/jdbdateedit.pas b/components/jujiboutils/jujibo-utils/src/jdbdateedit.pas index 190c68cdd..77ccf52a8 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbdateedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbdateedit.pas @@ -23,7 +23,7 @@ interface uses Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, - SysUtils; + SysUtils, jinputconsts; type @@ -171,7 +171,7 @@ begin end else begin - ShowMessage(Caption + ' no es un valor válido'); + ShowMessage(Format(SInvalidDate, [Caption])); Caption := FDataLink.Field.AsString; SelectAll; SetFocus; diff --git a/components/jujiboutils/jujibo-utils/src/jdbdatetimeedit.pas b/components/jujiboutils/jujibo-utils/src/jdbdatetimeedit.pas index cdbb5b20d..13f5e9cf7 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbdatetimeedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbdatetimeedit.pas @@ -23,7 +23,7 @@ interface uses Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, - SysUtils; + SysUtils, jinputconsts; type @@ -170,7 +170,7 @@ begin end else begin - ShowMessage(Caption + ' no es un valor válido'); + ShowMessage(Format(SInvalidDateTime, [Caption])); Caption := FDataLink.Field.AsString; SelectAll; SetFocus; diff --git a/components/jujiboutils/jujibo-utils/src/jdbfloatedit.pas b/components/jujiboutils/jujibo-utils/src/jdbfloatedit.pas index d6c5c8362..753194fdd 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbfloatedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbfloatedit.pas @@ -23,7 +23,7 @@ interface uses Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, - SysUtils; + SysUtils, jinputconsts; type @@ -191,7 +191,7 @@ begin begin if FDataLink.Field <> nil then begin - ShowMessage(Caption + ' no es un valor válido'); + ShowMessage(Format(SInvalidNumber, [Caption])); Caption := FDataLink.Field.AsString; SelectAll; SetFocus; diff --git a/components/jujiboutils/jujibo-utils/src/jdbgridutils.pas b/components/jujiboutils/jujibo-utils/src/jdbgridutils.pas index dd0f12647..a974fd365 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbgridutils.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbgridutils.pas @@ -23,7 +23,7 @@ interface uses Classes, SysUtils, Grids, Dialogs, LCLType, DBGrids, Controls, DB, - jcontrolutils; + jcontrolutils, jinputconsts; type @@ -46,7 +46,7 @@ type CellEditor: TStringCellEditor; theGrid: TDBGrid; function isNull: boolean; - property format: string read getFormat write setFormat; + property DisplayFormat: string read getFormat write setFormat; constructor Create; destructor Destroy; override; function Editor(aGrid: TDBGrid): TStringCellEditor; @@ -71,7 +71,7 @@ type CellEditor: TStringCellEditor; theGrid: TDBGrid; function isNull: boolean; - property format: string read getFormat write setFormat; + property DisplayFormat: string read getFormat write setFormat; constructor Create; destructor Destroy; override; function Editor(aGrid: TDBGrid): TStringCellEditor; @@ -96,7 +96,7 @@ type CellEditor: TStringCellEditor; theGrid: TDBGrid; function isNull: boolean; - property format: string read getFormat write setFormat; + property DisplayFormat: string read getFormat write setFormat; constructor Create; destructor Destroy; override; function Editor(aGrid: TDBGrid): TStringCellEditor; @@ -198,15 +198,15 @@ begin end else begin - ShowMessage(CellEditor.Caption + ' no es una fecha válida'); - CellEditor.Text := FormatDateTime(format, theValue); + ShowMessage(Format(SInvalidDateTime, [CellEditor.Caption])); + CellEditor.Text := FormatDateTime(DisplayFormat, theValue); end; end; procedure TJDbGridDateTimeCtrl.formatInput; begin if theValue <> 0 then - CellEditor.Caption := FormatDateTime(format, theValue); + CellEditor.Caption := FormatDateTime(DisplayFormat, theValue); end; procedure TJDbGridDateTimeCtrl.setFormat(const AValue: string); @@ -228,8 +228,8 @@ begin if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and (not IsValidDateTimeString(NormalizeDateTime(CellEditor.Caption, theValue))) then begin - ShowMessage(CellEditor.Caption + ' no es una fecha válida'); - CellEditor.Text := FormatDateTime(format, theValue); + ShowMessage(Format(SInvalidDateTime, [CellEditor.Caption])); + CellEditor.Text := FormatDateTime(DisplayFormat, theValue); CellEditor.SelectAll; Key := VK_UNKNOWN; end @@ -239,7 +239,7 @@ begin if Field.IsNull then CellEditor.Text := '' else - CellEditor.Text := FormatDateTime(format, Field.AsDateTime); + CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime); updated := True; theGrid.SetFocus; // No perder el foco end @@ -279,7 +279,7 @@ begin CellEditor.OnKeyDown := @OnKeyDown; CellEditor.OnEditingDone := @myEditOnEditingDone; CellEditor.OnKeyPress := @OnKeyPress; - format := ShortDateFormat + ' ' + ShortTimeFormat; + DisplayFormat := ShortDateFormat + ' ' + ShortTimeFormat; end; destructor TJDbGridDateTimeCtrl.Destroy; @@ -339,15 +339,15 @@ begin end else begin - ShowMessage(CellEditor.Caption + ' no es una hora válida'); - CellEditor.Text := FormatDateTime(format, theValue); + ShowMessage(Format(SInvalidTime, [CellEditor.Caption])); + CellEditor.Text := FormatDateTime(DisplayFormat, theValue); end; end; procedure TJDbGridTimeCtrl.formatInput; begin if theValue <> 0 then - CellEditor.Caption := FormatDateTime(format, theValue); + CellEditor.Caption := FormatDateTime(DisplayFormat, theValue); end; procedure TJDbGridTimeCtrl.setFormat(const AValue: string); @@ -376,8 +376,8 @@ begin if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and (not IsValidTimeString(NormalizeTime(CellEditor.Caption, theValue))) then begin - ShowMessage(CellEditor.Caption + ' no es una hora válida'); - CellEditor.Text := FormatDateTime(format, theValue); + ShowMessage(Format(SInvalidTime, [CellEditor.Caption])); + CellEditor.Text := FormatDateTime(DisplayFormat, theValue); CellEditor.SelectAll; Key := VK_UNKNOWN; end @@ -387,7 +387,7 @@ begin if Field.IsNull then CellEditor.Text := '' else - CellEditor.Text := FormatDateTime(format, Field.AsDateTime); + CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime); updated := True; theGrid.SetFocus; // No perder el foco end @@ -427,7 +427,7 @@ begin CellEditor.OnKeyDown := @OnKeyDown; CellEditor.OnEditingDone := @myEditOnEditingDone; CellEditor.OnKeyPress := @OnKeyPress; // se sobreescribe por el Grid :( - format := ShortTimeFormat; + DisplayFormat := ShortTimeFormat; end; destructor TJDbGridTimeCtrl.Destroy; @@ -487,8 +487,8 @@ begin end else begin - ShowMessage(CellEditor.Caption + ' no es una fecha válida'); - CellEditor.Text := FormatDateTime(format, theValue); + ShowMessage(Format(SInvalidDate, [CellEditor.Caption])); + CellEditor.Text := FormatDateTime(DisplayFormat, theValue); end; //formatInput; end; @@ -496,7 +496,7 @@ end; procedure TJDbGridDateCtrl.formatInput; begin if theValue <> 0 then - CellEditor.Caption := FormatDateTime(format, theValue); + CellEditor.Caption := FormatDateTime(DisplayFormat, theValue); end; procedure TJDbGridDateCtrl.setFormat(const AValue: string); @@ -518,8 +518,8 @@ begin if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and (not IsValidDateString(NormalizeDate(CellEditor.Caption, theValue))) then begin - ShowMessage(CellEditor.Caption + ' no es una fecha válida'); - CellEditor.Text := FormatDateTime(format, theValue); + ShowMessage(Format(SInvalidDate, [CellEditor.Caption])); + CellEditor.Text := FormatDateTime(DisplayFormat, theValue); CellEditor.SelectAll; Key := VK_UNKNOWN; end @@ -529,7 +529,7 @@ begin if Field.IsNull then CellEditor.Text := '' else - CellEditor.Text := FormatDateTime(format, Field.AsDateTime); + CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime); updated := True; theGrid.SetFocus; // No perder el foco end @@ -570,7 +570,7 @@ begin CellEditor.OnKeyDown := @OnKeyDown; CellEditor.OnEditingDone := @myEditOnEditingDone; CellEditor.OnKeyPress := @OnKeyPress; // se sobreescribe por el Grid :( - format := ShortDateFormat; + DisplayFormat := ShortDateFormat; end; destructor TJDbGridDateCtrl.Destroy; @@ -621,7 +621,7 @@ begin end else begin - ShowMessage(CellEditor.Caption + ' no es un número válido'); + ShowMessage(Format(SInvalidNumber, [CellEditor.Caption])); CellEditor.Text := FloatToStr(theValue); end; end; @@ -650,7 +650,7 @@ begin if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and (not IsValidFloat(CellEditor.Caption)) then begin - ShowMessage(CellEditor.Caption + ' no es número válido'); + ShowMessage(Format(SInvalidNumber, [CellEditor.Caption])); CellEditor.Text := FloatToStr(theValue); CellEditor.SelectAll; Key := VK_UNKNOWN; @@ -752,7 +752,7 @@ begin if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and (not IsValidInteger(CellEditor.Caption)) then begin - ShowMessage(CellEditor.Caption + ' no es un número válido'); + ShowMessage(Format(SInvalidNumber, [CellEditor.Caption])); CellEditor.Text := IntToStr(theValue); CellEditor.SelectAll; Key := VK_UNKNOWN; @@ -800,7 +800,7 @@ begin end else begin - ShowMessage(CellEditor.Caption + ' no es un número válido'); + ShowMessage(Format(SInvalidNumber, [CellEditor.Caption])); CellEditor.Text := IntToStr(theValue); end; end; diff --git a/components/jujiboutils/jujibo-utils/src/jdbintegeredit.pas b/components/jujiboutils/jujibo-utils/src/jdbintegeredit.pas index c23e4b380..ba03d7c55 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbintegeredit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbintegeredit.pas @@ -23,7 +23,7 @@ interface uses Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, - SysUtils; + SysUtils, jinputconsts; type @@ -164,7 +164,7 @@ begin FDataLink.Field.Text := Text else begin - ShowMessage(Caption + ' no es un valor válido'); + ShowMessage(Format(SInvalidNumber, [Caption])); Caption := FDataLink.Field.AsString; SelectAll; SetFocus; diff --git a/components/jujiboutils/jujibo-utils/src/jdblabeledcurrencyedit.pas b/components/jujiboutils/jujibo-utils/src/jdblabeledcurrencyedit.pas index aa8c375c6..9d9b65367 100644 --- a/components/jujiboutils/jujibo-utils/src/jdblabeledcurrencyedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdblabeledcurrencyedit.pas @@ -24,7 +24,7 @@ interface uses Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, - SysUtils; + SysUtils, jinputconsts; type @@ -187,7 +187,7 @@ begin begin if FDataLink.Field <> nil then begin - ShowMessage(Caption + ' no es un valor válido'); + ShowMessage(Format(SInvalidNumber, [Caption])); Caption := FDataLink.Field.AsString; SelectAll; SetFocus; diff --git a/components/jujiboutils/jujibo-utils/src/jdblabeleddateedit.pas b/components/jujiboutils/jujibo-utils/src/jdblabeleddateedit.pas index 3e8b5b2f5..6a36b5b5e 100644 --- a/components/jujiboutils/jujibo-utils/src/jdblabeleddateedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdblabeleddateedit.pas @@ -23,7 +23,7 @@ interface uses Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, - SysUtils; + SysUtils, jinputconsts; type @@ -167,7 +167,7 @@ begin end else begin - ShowMessage(Caption + ' no es un valor válido'); + ShowMessage(Format(SInvalidDate, [Caption])); Caption := FDataLink.Field.AsString; SelectAll; SetFocus; diff --git a/components/jujiboutils/jujibo-utils/src/jdblabeleddatetimeedit.pas b/components/jujiboutils/jujibo-utils/src/jdblabeleddatetimeedit.pas index a3c0b724d..7c286c19b 100644 --- a/components/jujiboutils/jujibo-utils/src/jdblabeleddatetimeedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdblabeleddatetimeedit.pas @@ -23,7 +23,7 @@ interface uses Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, - SysUtils; + SysUtils, jinputconsts; type @@ -169,7 +169,7 @@ begin end else begin - ShowMessage(Caption + ' no es un valor válido'); + ShowMessage(Format(SInvalidDateTime, [Caption])); Caption := FDataLink.Field.AsString; SelectAll; SetFocus; diff --git a/components/jujiboutils/jujibo-utils/src/jdblabeledfloatedit.pas b/components/jujiboutils/jujibo-utils/src/jdblabeledfloatedit.pas index 660aadf6a..fa0b5c0cd 100644 --- a/components/jujiboutils/jujibo-utils/src/jdblabeledfloatedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdblabeledfloatedit.pas @@ -24,7 +24,7 @@ interface uses Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, - SysUtils; + SysUtils, jinputconsts; type TJDBLabeledFloatEdit = class(TCustomLabeledEdit) @@ -183,7 +183,7 @@ begin begin if FDataLink.Field <> nil then begin - ShowMessage(Caption + ' no es un valor válido'); + ShowMessage(Format(SInvalidNumber, [Caption])); Caption := FDataLink.Field.AsString; SelectAll; SetFocus; diff --git a/components/jujiboutils/jujibo-utils/src/jdblabeledintegeredit.pas b/components/jujiboutils/jujibo-utils/src/jdblabeledintegeredit.pas index 57a801e2f..33fd1d4f6 100644 --- a/components/jujiboutils/jujibo-utils/src/jdblabeledintegeredit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdblabeledintegeredit.pas @@ -24,7 +24,7 @@ interface uses Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, - SysUtils; + SysUtils, jinputconsts; type @@ -159,7 +159,7 @@ begin FDataLink.Field.Text := Text else begin - ShowMessage(Caption + ' no es un valor válido'); + ShowMessage(Format(SInvalidNumber, [Caption])); Caption := FDataLink.Field.AsString; SelectAll; SetFocus; diff --git a/components/jujiboutils/jujibo-utils/src/jdblabeledtimeedit.pas b/components/jujiboutils/jujibo-utils/src/jdblabeledtimeedit.pas index 1a89344d0..443cb73d4 100644 --- a/components/jujiboutils/jujibo-utils/src/jdblabeledtimeedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdblabeledtimeedit.pas @@ -6,7 +6,7 @@ interface uses Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, - SysUtils, jcontrolutils; + SysUtils, jcontrolutils, jinputconsts; type TJDBLabeledTimeEdit = class(TCustomLabeledEdit) @@ -143,7 +143,7 @@ begin end else begin - ShowMessage(Caption + ' no es una hora válida'); + ShowMessage(Format(SInvalidTime, [Text])); Caption := FDataLink.Field.AsString; SelectAll; SetFocus; diff --git a/components/jujiboutils/jujibo-utils/src/jdbtimeedit.pas b/components/jujiboutils/jujibo-utils/src/jdbtimeedit.pas index 3496e154d..6d8ce1726 100644 --- a/components/jujiboutils/jujibo-utils/src/jdbtimeedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jdbtimeedit.pas @@ -23,7 +23,7 @@ interface uses Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, - SysUtils, jcontrolutils; + SysUtils, jcontrolutils, jinputconsts; type TJDBTimeEdit = class(TCustomEdit) @@ -168,7 +168,7 @@ begin end else begin - ShowMessage(Caption + ' no es una hora válida'); + ShowMessage(Format(SInvalidTime, [Text])); Caption := FDataLink.Field.AsString; SelectAll; SetFocus; diff --git a/components/jujiboutils/jujibo-utils/src/jfloatedit.pas b/components/jujiboutils/jujibo-utils/src/jfloatedit.pas index b4025be7a..d36e5504a 100644 --- a/components/jujiboutils/jujibo-utils/src/jfloatedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jfloatedit.pas @@ -22,7 +22,8 @@ unit JFloatEdit; interface uses - Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, Dialogs; + Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, + Dialogs, jinputconsts; type @@ -192,7 +193,7 @@ begin theValue := StrToCurr(Text) else begin - ShowMessage(Text + ' no es un valor válido'); + ShowMessage(Format(SInvalidNumber, [Text])); SetFocus; end; if fDecimals > 0 then diff --git a/components/jujiboutils/jujibo-utils/src/jinputconsts.pas b/components/jujiboutils/jujibo-utils/src/jinputconsts.pas new file mode 100644 index 000000000..e6704939f --- /dev/null +++ b/components/jujiboutils/jujibo-utils/src/jinputconsts.pas @@ -0,0 +1,17 @@ +unit jinputconsts; + +{$mode objfpc}{$H+} + +interface + +resourcestring + + SInvalidNumber = '%s is not a valid number'; + SInvalidDate = '%s is not a valid date'; + SInvalidTime = '%s is not a valid time'; + SInvalidDateTime = '%s is not a valid date-time'; + +implementation + +end. + diff --git a/components/jujiboutils/jujibo-utils/src/jintegeredit.pas b/components/jujiboutils/jujibo-utils/src/jintegeredit.pas index 94f9aea35..ffdfe72d6 100644 --- a/components/jujiboutils/jujibo-utils/src/jintegeredit.pas +++ b/components/jujiboutils/jujibo-utils/src/jintegeredit.pas @@ -22,7 +22,8 @@ unit JIntegerEdit; interface uses - Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, Dialogs; + Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, + Dialogs, jinputconsts; type @@ -167,7 +168,7 @@ begin theValue := StrToInt(Text) else begin - ShowMessage(Text + ' no es un valor válido'); + ShowMessage(Format(SInvalidNumber, [Text])); SetFocus; end; formatInput; diff --git a/components/jujiboutils/jujibo-utils/src/jlabeledcurrencyedit.pas b/components/jujiboutils/jujibo-utils/src/jlabeledcurrencyedit.pas index 9af1fd336..3ae61167f 100644 --- a/components/jujiboutils/jujibo-utils/src/jlabeledcurrencyedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jlabeledcurrencyedit.pas @@ -22,7 +22,8 @@ unit JLabeledCurrencyEdit; interface uses - Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics, Dialogs; + Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics, + Dialogs, jinputconsts; type @@ -190,7 +191,7 @@ begin theValue := StrToCurr(Text) else begin - ShowMessage(Text + ' no es un valor válido'); + ShowMessage(Format(SInvalidNumber, [Text])); SetFocus; end; if fDecimals > 0 then diff --git a/components/jujiboutils/jujibo-utils/src/jlabeleddateedit.pas b/components/jujiboutils/jujibo-utils/src/jlabeleddateedit.pas index b9de5b5e3..d4bac9440 100644 --- a/components/jujiboutils/jujibo-utils/src/jlabeleddateedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jlabeleddateedit.pas @@ -22,7 +22,7 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics, - Dialogs, jcontrolutils; + Dialogs, jcontrolutils, jinputconsts; type @@ -161,7 +161,7 @@ begin theValue := StrToDate(Text) else begin - ShowMessage(Text + ' no es una fecha válida'); + ShowMessage(Format(SInvalidDate, [Text])); SetFocus; end; formatInput; diff --git a/components/jujiboutils/jujibo-utils/src/jlabeleddatetimeedit.pas b/components/jujiboutils/jujibo-utils/src/jlabeleddatetimeedit.pas index 8c57d72c6..895439a73 100644 --- a/components/jujiboutils/jujibo-utils/src/jlabeleddatetimeedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jlabeleddatetimeedit.pas @@ -25,7 +25,7 @@ interface uses Classes, LResources, Controls, ExtCtrls, LCLType, Dialogs, - SysUtils; + SysUtils, jinputconsts; type TJLabeledDateTimeEdit = class(TCustomLabeledEdit) @@ -53,7 +53,7 @@ type property DisplayFormat: string read getFormat write setFormat; property Value: TDateTime read getValue write setValue; - property Action; + property Action; property Align; property Alignment; property Anchors; @@ -111,7 +111,7 @@ uses procedure Register; begin {$I jlabeleddatetimeedit_icon.lrs} - RegisterComponents('Additional',[TJLabeledDateTimeEdit]); + RegisterComponents('Additional', [TJLabeledDateTimeEdit]); end; function TJLabeledDateTimeEdit.getFormat: string; @@ -161,7 +161,7 @@ begin Text := NormalizeDateTime(Text, theValue); if (Length(bufText) > 0) and (Length(Text) = 0) then begin - ShowMessage(bufText + ' no es una fecha-hora válida'); + ShowMessage(Format(SInvalidDateTime, [bufText])); SetFocus; end else @@ -172,7 +172,7 @@ begin theValue := StrToDateTime(Text) else begin - ShowMessage(Text + ' no es una fecha-hora válida'); + ShowMessage(Format(SInvalidDateTime, [Text])); SetFocus; end; formatInput; @@ -206,3 +206,4 @@ end; end. + diff --git a/components/jujiboutils/jujibo-utils/src/jlabeledfloatedit.pas b/components/jujiboutils/jujibo-utils/src/jlabeledfloatedit.pas index 87c4fb345..e0ea182fd 100644 --- a/components/jujiboutils/jujibo-utils/src/jlabeledfloatedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jlabeledfloatedit.pas @@ -22,7 +22,8 @@ unit JLabeledFloatEdit; interface uses - Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics, Dialogs; + Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics, + Dialogs, jinputconsts; type @@ -188,7 +189,7 @@ begin theValue := StrToCurr(Text) else begin - ShowMessage(Text + ' no es un valor válido'); + ShowMessage(Format(SInvalidNumber, [Text])); SetFocus; end; if fDecimals > 0 then diff --git a/components/jujiboutils/jujibo-utils/src/jlabeledintegeredit.pas b/components/jujiboutils/jujibo-utils/src/jlabeledintegeredit.pas index 9a405703a..e5be5e3b6 100644 --- a/components/jujiboutils/jujibo-utils/src/jlabeledintegeredit.pas +++ b/components/jujiboutils/jujibo-utils/src/jlabeledintegeredit.pas @@ -22,7 +22,8 @@ unit JLabeledIntegerEdit; interface uses - Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics, Dialogs; + Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics, + Dialogs, jinputconsts; type @@ -163,7 +164,7 @@ begin theValue := StrToInt(Text) else begin - ShowMessage(Text + ' no es un valor válido'); + ShowMessage(Format(SInvalidNumber, [Text])); SetFocus; end; formatInput; diff --git a/components/jujiboutils/jujibo-utils/src/jlabeledtimeedit.pas b/components/jujiboutils/jujibo-utils/src/jlabeledtimeedit.pas index e9d3ea9bb..b0172165f 100644 --- a/components/jujiboutils/jujibo-utils/src/jlabeledtimeedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jlabeledtimeedit.pas @@ -23,14 +23,14 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics, - Dialogs, jcontrolutils; + Dialogs, jcontrolutils, jinputconsts; type TJLabeledTimeEdit = class(TCustomLabeledEdit) private { Private declarations } theValue: TTime; - hasValue: Boolean; + hasValue: boolean; fFormat: string; function getFormat: string; function getValue: TTime; @@ -108,7 +108,7 @@ implementation procedure Register; begin {$I jlabeledtimeedit_icon.lrs} - RegisterComponents('Additional',[TJLabeledTimeEdit]); + RegisterComponents('Additional', [TJLabeledTimeEdit]); end; @@ -131,7 +131,7 @@ end; procedure TJLabeledTimeEdit.setValue(const AValue: TTime); begin theValue := AValue; - hasValue:= True; + hasValue := True; formatInput; end; @@ -139,7 +139,8 @@ procedure TJLabeledTimeEdit.FormatInput; begin if hasValue then Text := FormatDateTime(fFormat, theValue) - else Text := ''; + else + Text := ''; end; procedure TJLabeledTimeEdit.DoEnter; @@ -157,19 +158,19 @@ begin inherited DoExit; Text := NormalizeTime(Text, theValue); if Length(Text) = 0 then - begin + begin theValue := 0; - hasValue:= False; - end + hasValue := False; + end else if IsValidTimeString(Text) then - begin + begin theValue := StrToTime(Text); - hasValue:=True; - end + hasValue := True; + end else begin - ShowMessage(Text + ' no es una hora válida'); + ShowMessage(Format(SInvalidTime, [Text])); SetFocus; end; formatInput; @@ -188,7 +189,7 @@ begin Text := ''; DisplayFormat := 'hh:mm:ss'; Value := 0; - hasValue:= True; + hasValue := True; end; destructor TJLabeledTimeEdit.Destroy; @@ -202,3 +203,4 @@ begin end; end. + diff --git a/components/jujiboutils/jujibo-utils/src/jtimeedit.pas b/components/jujiboutils/jujibo-utils/src/jtimeedit.pas index 85659e1be..7134bbc62 100644 --- a/components/jujiboutils/jujibo-utils/src/jtimeedit.pas +++ b/components/jujiboutils/jujibo-utils/src/jtimeedit.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, - Dialogs, jcontrolutils; + Dialogs, jcontrolutils, jinputconsts; type @@ -16,7 +16,7 @@ type private { Private declarations } theValue: TTime; - hasValue: Boolean; + hasValue: boolean; fFormat: string; function getFormat: string; function getValue: TTime; @@ -121,7 +121,7 @@ end; procedure TJTimeEdit.setValue(const AValue: TTime); begin theValue := AValue; - hasValue:= True; + hasValue := True; formatInput; end; @@ -129,7 +129,8 @@ procedure TJTimeEdit.FormatInput; begin if hasValue then Text := FormatDateTime(fFormat, theValue) - else Text := ''; + else + Text := ''; end; procedure TJTimeEdit.DoEnter; @@ -147,19 +148,19 @@ begin inherited DoExit; Text := NormalizeTime(Text, theValue); if Length(Text) = 0 then - begin + begin theValue := 0; - hasValue:= False; - end + hasValue := False; + end else if IsValidTimeString(Text) then - begin + begin theValue := StrToTime(Text); - hasValue:=True; - end + hasValue := True; + end else begin - ShowMessage(Text + ' no es una hora válida'); + ShowMessage(Format(SInvalidTime, [Text])); SetFocus; end; formatInput; @@ -178,7 +179,7 @@ begin Text := ''; DisplayFormat := 'hh:mm:ss'; Value := 0; - hasValue:= True; + hasValue := True; end; destructor TJTimeEdit.Destroy;