Change error messages to resourcestring

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2030 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
jujibo
2011-09-28 16:34:37 +00:00
parent 14e1d28f21
commit b5e830223c
28 changed files with 136 additions and 104 deletions

View File

@ -18,7 +18,7 @@
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
<Files Count="28"> <Files Count="29">
<Item1> <Item1>
<Filename Value="src/jdbintegeredit.pas"/> <Filename Value="src/jdbintegeredit.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
@ -157,6 +157,10 @@
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
<UnitName Value="JDBLabeledFloatEdit"/> <UnitName Value="JDBLabeledFloatEdit"/>
</Item28> </Item28>
<Item29>
<Filename Value="src/jinputconsts.pas"/>
<UnitName Value="jinputconsts"/>
</Item29>
</Files> </Files>
<Type Value="RunAndDesignTime"/> <Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="2"> <RequiredPkgs Count="2">

View File

@ -13,7 +13,8 @@ uses
JDateEdit, JLabeledDateEdit, JDBGridControl, jdbgridutils, JDBLabeledEdit, JDateEdit, JLabeledDateEdit, JDBGridControl, jdbgridutils, JDBLabeledEdit,
JTimeEdit, JLabeledTimeEdit, JDBTimeEdit, JDBLabeledTimeEdit, JDateTimeEdit, JTimeEdit, JLabeledTimeEdit, JDBTimeEdit, JDBLabeledTimeEdit, JDateTimeEdit,
JLabeledDateTimeEdit, JDBDateTimeEdit, JDBLabeledDateTimeEdit, JFloatEdit, JLabeledDateTimeEdit, JDBDateTimeEdit, JDBLabeledDateTimeEdit, JFloatEdit,
JLabeledFloatEdit, JDBFloatEdit, JDBLabeledFloatEdit, LazarusPackageIntf; JLabeledFloatEdit, JDBFloatEdit, JDBLabeledFloatEdit, jinputconsts,
LazarusPackageIntf;
implementation implementation

View File

@ -22,7 +22,8 @@ unit JCurrencyEdit;
interface interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, Dialogs; Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics,
Dialogs, jinputconsts;
type type
@ -194,7 +195,7 @@ begin
theValue := StrToCurr(Text) theValue := StrToCurr(Text)
else else
begin begin
ShowMessage(Text + ' no es un valor válido'); ShowMessage(Format(SInvalidNumber, [Text]));
SetFocus; SetFocus;
end; end;
if fDecimals > 0 then if fDecimals > 0 then

View File

@ -23,7 +23,7 @@ interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics,
Dialogs, jcontrolutils; Dialogs, jcontrolutils, jinputconsts;
type type
@ -167,7 +167,7 @@ begin
theValue := StrToDate(Text) theValue := StrToDate(Text)
else else
begin begin
ShowMessage(Text + ' no es una fecha válida'); ShowMessage(Format(SInvalidDate, [Text]));
SetFocus; SetFocus;
end; end;
formatInput; formatInput;

View File

@ -24,7 +24,7 @@ interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics,
Dialogs, jcontrolutils; Dialogs, jcontrolutils, jinputconsts;
type type
TJDateTimeEdit = class(TCustomEdit) TJDateTimeEdit = class(TCustomEdit)
@ -161,7 +161,7 @@ begin
Text := NormalizeDateTime(Text, theValue); Text := NormalizeDateTime(Text, theValue);
if (Length(bufText) > 0) and (Length(Text) = 0) then if (Length(bufText) > 0) and (Length(Text) = 0) then
begin begin
ShowMessage(bufText + ' no es una fecha-hora válida'); ShowMessage(Format(SInvalidDateTime, [bufText]));
SetFocus; SetFocus;
end end
else else
@ -172,7 +172,7 @@ begin
theValue := StrToDateTime(Text) theValue := StrToDateTime(Text)
else else
begin begin
ShowMessage(Text + ' no es una fecha-hora válida'); ShowMessage(Format(SInvalidDateTime, [Text]));
SetFocus; SetFocus;
end; end;
formatInput; formatInput;

View File

@ -23,7 +23,7 @@ interface
uses uses
Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs,
SysUtils; SysUtils,jinputconsts;
type type
@ -192,7 +192,7 @@ begin
begin begin
if FDataLink.Field <> nil then if FDataLink.Field <> nil then
begin begin
ShowMessage(Caption + ' no es un valor válido'); ShowMessage(Format(SInvalidNumber, [Caption]));
Caption := FDataLink.Field.AsString; Caption := FDataLink.Field.AsString;
SelectAll; SelectAll;
SetFocus; SetFocus;

View File

@ -23,7 +23,7 @@ interface
uses uses
Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs,
SysUtils; SysUtils, jinputconsts;
type type
@ -171,7 +171,7 @@ begin
end end
else else
begin begin
ShowMessage(Caption + ' no es un valor válido'); ShowMessage(Format(SInvalidDate, [Caption]));
Caption := FDataLink.Field.AsString; Caption := FDataLink.Field.AsString;
SelectAll; SelectAll;
SetFocus; SetFocus;

View File

@ -23,7 +23,7 @@ interface
uses uses
Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs,
SysUtils; SysUtils, jinputconsts;
type type
@ -170,7 +170,7 @@ begin
end end
else else
begin begin
ShowMessage(Caption + ' no es un valor válido'); ShowMessage(Format(SInvalidDateTime, [Caption]));
Caption := FDataLink.Field.AsString; Caption := FDataLink.Field.AsString;
SelectAll; SelectAll;
SetFocus; SetFocus;

View File

@ -23,7 +23,7 @@ interface
uses uses
Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs,
SysUtils; SysUtils, jinputconsts;
type type
@ -191,7 +191,7 @@ begin
begin begin
if FDataLink.Field <> nil then if FDataLink.Field <> nil then
begin begin
ShowMessage(Caption + ' no es un valor válido'); ShowMessage(Format(SInvalidNumber, [Caption]));
Caption := FDataLink.Field.AsString; Caption := FDataLink.Field.AsString;
SelectAll; SelectAll;
SetFocus; SetFocus;

View File

@ -23,7 +23,7 @@ interface
uses uses
Classes, SysUtils, Grids, Dialogs, LCLType, DBGrids, Controls, DB, Classes, SysUtils, Grids, Dialogs, LCLType, DBGrids, Controls, DB,
jcontrolutils; jcontrolutils, jinputconsts;
type type
@ -46,7 +46,7 @@ type
CellEditor: TStringCellEditor; CellEditor: TStringCellEditor;
theGrid: TDBGrid; theGrid: TDBGrid;
function isNull: boolean; function isNull: boolean;
property format: string read getFormat write setFormat; property DisplayFormat: string read getFormat write setFormat;
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
function Editor(aGrid: TDBGrid): TStringCellEditor; function Editor(aGrid: TDBGrid): TStringCellEditor;
@ -71,7 +71,7 @@ type
CellEditor: TStringCellEditor; CellEditor: TStringCellEditor;
theGrid: TDBGrid; theGrid: TDBGrid;
function isNull: boolean; function isNull: boolean;
property format: string read getFormat write setFormat; property DisplayFormat: string read getFormat write setFormat;
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
function Editor(aGrid: TDBGrid): TStringCellEditor; function Editor(aGrid: TDBGrid): TStringCellEditor;
@ -96,7 +96,7 @@ type
CellEditor: TStringCellEditor; CellEditor: TStringCellEditor;
theGrid: TDBGrid; theGrid: TDBGrid;
function isNull: boolean; function isNull: boolean;
property format: string read getFormat write setFormat; property DisplayFormat: string read getFormat write setFormat;
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
function Editor(aGrid: TDBGrid): TStringCellEditor; function Editor(aGrid: TDBGrid): TStringCellEditor;
@ -198,15 +198,15 @@ begin
end end
else else
begin begin
ShowMessage(CellEditor.Caption + ' no es una fecha válida'); ShowMessage(Format(SInvalidDateTime, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(format, theValue); CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
end; end;
end; end;
procedure TJDbGridDateTimeCtrl.formatInput; procedure TJDbGridDateTimeCtrl.formatInput;
begin begin
if theValue <> 0 then if theValue <> 0 then
CellEditor.Caption := FormatDateTime(format, theValue); CellEditor.Caption := FormatDateTime(DisplayFormat, theValue);
end; end;
procedure TJDbGridDateTimeCtrl.setFormat(const AValue: string); 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 if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and
(not IsValidDateTimeString(NormalizeDateTime(CellEditor.Caption, theValue))) then (not IsValidDateTimeString(NormalizeDateTime(CellEditor.Caption, theValue))) then
begin begin
ShowMessage(CellEditor.Caption + ' no es una fecha válida'); ShowMessage(Format(SInvalidDateTime, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(format, theValue); CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
CellEditor.SelectAll; CellEditor.SelectAll;
Key := VK_UNKNOWN; Key := VK_UNKNOWN;
end end
@ -239,7 +239,7 @@ begin
if Field.IsNull then if Field.IsNull then
CellEditor.Text := '' CellEditor.Text := ''
else else
CellEditor.Text := FormatDateTime(format, Field.AsDateTime); CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
updated := True; updated := True;
theGrid.SetFocus; // No perder el foco theGrid.SetFocus; // No perder el foco
end end
@ -279,7 +279,7 @@ begin
CellEditor.OnKeyDown := @OnKeyDown; CellEditor.OnKeyDown := @OnKeyDown;
CellEditor.OnEditingDone := @myEditOnEditingDone; CellEditor.OnEditingDone := @myEditOnEditingDone;
CellEditor.OnKeyPress := @OnKeyPress; CellEditor.OnKeyPress := @OnKeyPress;
format := ShortDateFormat + ' ' + ShortTimeFormat; DisplayFormat := ShortDateFormat + ' ' + ShortTimeFormat;
end; end;
destructor TJDbGridDateTimeCtrl.Destroy; destructor TJDbGridDateTimeCtrl.Destroy;
@ -339,15 +339,15 @@ begin
end end
else else
begin begin
ShowMessage(CellEditor.Caption + ' no es una hora válida'); ShowMessage(Format(SInvalidTime, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(format, theValue); CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
end; end;
end; end;
procedure TJDbGridTimeCtrl.formatInput; procedure TJDbGridTimeCtrl.formatInput;
begin begin
if theValue <> 0 then if theValue <> 0 then
CellEditor.Caption := FormatDateTime(format, theValue); CellEditor.Caption := FormatDateTime(DisplayFormat, theValue);
end; end;
procedure TJDbGridTimeCtrl.setFormat(const AValue: string); 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 if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and
(not IsValidTimeString(NormalizeTime(CellEditor.Caption, theValue))) then (not IsValidTimeString(NormalizeTime(CellEditor.Caption, theValue))) then
begin begin
ShowMessage(CellEditor.Caption + ' no es una hora válida'); ShowMessage(Format(SInvalidTime, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(format, theValue); CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
CellEditor.SelectAll; CellEditor.SelectAll;
Key := VK_UNKNOWN; Key := VK_UNKNOWN;
end end
@ -387,7 +387,7 @@ begin
if Field.IsNull then if Field.IsNull then
CellEditor.Text := '' CellEditor.Text := ''
else else
CellEditor.Text := FormatDateTime(format, Field.AsDateTime); CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
updated := True; updated := True;
theGrid.SetFocus; // No perder el foco theGrid.SetFocus; // No perder el foco
end end
@ -427,7 +427,7 @@ begin
CellEditor.OnKeyDown := @OnKeyDown; CellEditor.OnKeyDown := @OnKeyDown;
CellEditor.OnEditingDone := @myEditOnEditingDone; CellEditor.OnEditingDone := @myEditOnEditingDone;
CellEditor.OnKeyPress := @OnKeyPress; // se sobreescribe por el Grid :( CellEditor.OnKeyPress := @OnKeyPress; // se sobreescribe por el Grid :(
format := ShortTimeFormat; DisplayFormat := ShortTimeFormat;
end; end;
destructor TJDbGridTimeCtrl.Destroy; destructor TJDbGridTimeCtrl.Destroy;
@ -487,8 +487,8 @@ begin
end end
else else
begin begin
ShowMessage(CellEditor.Caption + ' no es una fecha válida'); ShowMessage(Format(SInvalidDate, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(format, theValue); CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
end; end;
//formatInput; //formatInput;
end; end;
@ -496,7 +496,7 @@ end;
procedure TJDbGridDateCtrl.formatInput; procedure TJDbGridDateCtrl.formatInput;
begin begin
if theValue <> 0 then if theValue <> 0 then
CellEditor.Caption := FormatDateTime(format, theValue); CellEditor.Caption := FormatDateTime(DisplayFormat, theValue);
end; end;
procedure TJDbGridDateCtrl.setFormat(const AValue: string); 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 if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and
(not IsValidDateString(NormalizeDate(CellEditor.Caption, theValue))) then (not IsValidDateString(NormalizeDate(CellEditor.Caption, theValue))) then
begin begin
ShowMessage(CellEditor.Caption + ' no es una fecha válida'); ShowMessage(Format(SInvalidDate, [CellEditor.Caption]));
CellEditor.Text := FormatDateTime(format, theValue); CellEditor.Text := FormatDateTime(DisplayFormat, theValue);
CellEditor.SelectAll; CellEditor.SelectAll;
Key := VK_UNKNOWN; Key := VK_UNKNOWN;
end end
@ -529,7 +529,7 @@ begin
if Field.IsNull then if Field.IsNull then
CellEditor.Text := '' CellEditor.Text := ''
else else
CellEditor.Text := FormatDateTime(format, Field.AsDateTime); CellEditor.Text := FormatDateTime(DisplayFormat, Field.AsDateTime);
updated := True; updated := True;
theGrid.SetFocus; // No perder el foco theGrid.SetFocus; // No perder el foco
end end
@ -570,7 +570,7 @@ begin
CellEditor.OnKeyDown := @OnKeyDown; CellEditor.OnKeyDown := @OnKeyDown;
CellEditor.OnEditingDone := @myEditOnEditingDone; CellEditor.OnEditingDone := @myEditOnEditingDone;
CellEditor.OnKeyPress := @OnKeyPress; // se sobreescribe por el Grid :( CellEditor.OnKeyPress := @OnKeyPress; // se sobreescribe por el Grid :(
format := ShortDateFormat; DisplayFormat := ShortDateFormat;
end; end;
destructor TJDbGridDateCtrl.Destroy; destructor TJDbGridDateCtrl.Destroy;
@ -621,7 +621,7 @@ begin
end end
else else
begin begin
ShowMessage(CellEditor.Caption + ' no es un número válido'); ShowMessage(Format(SInvalidNumber, [CellEditor.Caption]));
CellEditor.Text := FloatToStr(theValue); CellEditor.Text := FloatToStr(theValue);
end; end;
end; end;
@ -650,7 +650,7 @@ begin
if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and
(not IsValidFloat(CellEditor.Caption)) then (not IsValidFloat(CellEditor.Caption)) then
begin begin
ShowMessage(CellEditor.Caption + ' no es número válido'); ShowMessage(Format(SInvalidNumber, [CellEditor.Caption]));
CellEditor.Text := FloatToStr(theValue); CellEditor.Text := FloatToStr(theValue);
CellEditor.SelectAll; CellEditor.SelectAll;
Key := VK_UNKNOWN; Key := VK_UNKNOWN;
@ -752,7 +752,7 @@ begin
if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and if (Key in [VK_RETURN, VK_TAB, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT]) and
(not IsValidInteger(CellEditor.Caption)) then (not IsValidInteger(CellEditor.Caption)) then
begin begin
ShowMessage(CellEditor.Caption + ' no es un número válido'); ShowMessage(Format(SInvalidNumber, [CellEditor.Caption]));
CellEditor.Text := IntToStr(theValue); CellEditor.Text := IntToStr(theValue);
CellEditor.SelectAll; CellEditor.SelectAll;
Key := VK_UNKNOWN; Key := VK_UNKNOWN;
@ -800,7 +800,7 @@ begin
end end
else else
begin begin
ShowMessage(CellEditor.Caption + ' no es un número válido'); ShowMessage(Format(SInvalidNumber, [CellEditor.Caption]));
CellEditor.Text := IntToStr(theValue); CellEditor.Text := IntToStr(theValue);
end; end;
end; end;

View File

@ -23,7 +23,7 @@ interface
uses uses
Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs,
SysUtils; SysUtils, jinputconsts;
type type
@ -164,7 +164,7 @@ begin
FDataLink.Field.Text := Text FDataLink.Field.Text := Text
else else
begin begin
ShowMessage(Caption + ' no es un valor válido'); ShowMessage(Format(SInvalidNumber, [Caption]));
Caption := FDataLink.Field.AsString; Caption := FDataLink.Field.AsString;
SelectAll; SelectAll;
SetFocus; SetFocus;

View File

@ -24,7 +24,7 @@ interface
uses uses
Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, Classes, LResources, Controls, ExtCtrls, DB, DBCtrls,
LMessages, LCLType, Dialogs, LMessages, LCLType, Dialogs,
SysUtils; SysUtils, jinputconsts;
type type
@ -187,7 +187,7 @@ begin
begin begin
if FDataLink.Field <> nil then if FDataLink.Field <> nil then
begin begin
ShowMessage(Caption + ' no es un valor válido'); ShowMessage(Format(SInvalidNumber, [Caption]));
Caption := FDataLink.Field.AsString; Caption := FDataLink.Field.AsString;
SelectAll; SelectAll;
SetFocus; SetFocus;

View File

@ -23,7 +23,7 @@ interface
uses uses
Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs,
SysUtils; SysUtils, jinputconsts;
type type
@ -167,7 +167,7 @@ begin
end end
else else
begin begin
ShowMessage(Caption + ' no es un valor válido'); ShowMessage(Format(SInvalidDate, [Caption]));
Caption := FDataLink.Field.AsString; Caption := FDataLink.Field.AsString;
SelectAll; SelectAll;
SetFocus; SetFocus;

View File

@ -23,7 +23,7 @@ interface
uses uses
Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs,
SysUtils; SysUtils, jinputconsts;
type type
@ -169,7 +169,7 @@ begin
end end
else else
begin begin
ShowMessage(Caption + ' no es un valor válido'); ShowMessage(Format(SInvalidDateTime, [Caption]));
Caption := FDataLink.Field.AsString; Caption := FDataLink.Field.AsString;
SelectAll; SelectAll;
SetFocus; SetFocus;

View File

@ -24,7 +24,7 @@ interface
uses uses
Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, Classes, LResources, Controls, ExtCtrls, DB, DBCtrls,
LMessages, LCLType, Dialogs, LMessages, LCLType, Dialogs,
SysUtils; SysUtils, jinputconsts;
type type
TJDBLabeledFloatEdit = class(TCustomLabeledEdit) TJDBLabeledFloatEdit = class(TCustomLabeledEdit)
@ -183,7 +183,7 @@ begin
begin begin
if FDataLink.Field <> nil then if FDataLink.Field <> nil then
begin begin
ShowMessage(Caption + ' no es un valor válido'); ShowMessage(Format(SInvalidNumber, [Caption]));
Caption := FDataLink.Field.AsString; Caption := FDataLink.Field.AsString;
SelectAll; SelectAll;
SetFocus; SetFocus;

View File

@ -24,7 +24,7 @@ interface
uses uses
Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, Classes, LResources, Controls, ExtCtrls, DB, DBCtrls,
LMessages, LCLType, Dialogs, LMessages, LCLType, Dialogs,
SysUtils; SysUtils, jinputconsts;
type type
@ -159,7 +159,7 @@ begin
FDataLink.Field.Text := Text FDataLink.Field.Text := Text
else else
begin begin
ShowMessage(Caption + ' no es un valor válido'); ShowMessage(Format(SInvalidNumber, [Caption]));
Caption := FDataLink.Field.AsString; Caption := FDataLink.Field.AsString;
SelectAll; SelectAll;
SetFocus; SetFocus;

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, Classes, LResources, Controls, ExtCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs,
SysUtils, jcontrolutils; SysUtils, jcontrolutils, jinputconsts;
type type
TJDBLabeledTimeEdit = class(TCustomLabeledEdit) TJDBLabeledTimeEdit = class(TCustomLabeledEdit)
@ -143,7 +143,7 @@ begin
end end
else else
begin begin
ShowMessage(Caption + ' no es una hora válida'); ShowMessage(Format(SInvalidTime, [Text]));
Caption := FDataLink.Field.AsString; Caption := FDataLink.Field.AsString;
SelectAll; SelectAll;
SetFocus; SetFocus;

View File

@ -23,7 +23,7 @@ interface
uses uses
Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs, Classes, LResources, Controls, StdCtrls, DB, DBCtrls, LMessages, LCLType, Dialogs,
SysUtils, jcontrolutils; SysUtils, jcontrolutils, jinputconsts;
type type
TJDBTimeEdit = class(TCustomEdit) TJDBTimeEdit = class(TCustomEdit)
@ -168,7 +168,7 @@ begin
end end
else else
begin begin
ShowMessage(Caption + ' no es una hora válida'); ShowMessage(Format(SInvalidTime, [Text]));
Caption := FDataLink.Field.AsString; Caption := FDataLink.Field.AsString;
SelectAll; SelectAll;
SetFocus; SetFocus;

View File

@ -22,7 +22,8 @@ unit JFloatEdit;
interface interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, Dialogs; Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics,
Dialogs, jinputconsts;
type type
@ -192,7 +193,7 @@ begin
theValue := StrToCurr(Text) theValue := StrToCurr(Text)
else else
begin begin
ShowMessage(Text + ' no es un valor válido'); ShowMessage(Format(SInvalidNumber, [Text]));
SetFocus; SetFocus;
end; end;
if fDecimals > 0 then if fDecimals > 0 then

View File

@ -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.

View File

@ -22,7 +22,8 @@ unit JIntegerEdit;
interface interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, Dialogs; Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics,
Dialogs, jinputconsts;
type type
@ -167,7 +168,7 @@ begin
theValue := StrToInt(Text) theValue := StrToInt(Text)
else else
begin begin
ShowMessage(Text + ' no es un valor válido'); ShowMessage(Format(SInvalidNumber, [Text]));
SetFocus; SetFocus;
end; end;
formatInput; formatInput;

View File

@ -22,7 +22,8 @@ unit JLabeledCurrencyEdit;
interface interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics, Dialogs; Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics,
Dialogs, jinputconsts;
type type
@ -190,7 +191,7 @@ begin
theValue := StrToCurr(Text) theValue := StrToCurr(Text)
else else
begin begin
ShowMessage(Text + ' no es un valor válido'); ShowMessage(Format(SInvalidNumber, [Text]));
SetFocus; SetFocus;
end; end;
if fDecimals > 0 then if fDecimals > 0 then

View File

@ -22,7 +22,7 @@ interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics, Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics,
Dialogs, jcontrolutils; Dialogs, jcontrolutils, jinputconsts;
type type
@ -161,7 +161,7 @@ begin
theValue := StrToDate(Text) theValue := StrToDate(Text)
else else
begin begin
ShowMessage(Text + ' no es una fecha válida'); ShowMessage(Format(SInvalidDate, [Text]));
SetFocus; SetFocus;
end; end;
formatInput; formatInput;

View File

@ -25,7 +25,7 @@ interface
uses uses
Classes, LResources, Controls, ExtCtrls, LCLType, Dialogs, Classes, LResources, Controls, ExtCtrls, LCLType, Dialogs,
SysUtils; SysUtils, jinputconsts;
type type
TJLabeledDateTimeEdit = class(TCustomLabeledEdit) TJLabeledDateTimeEdit = class(TCustomLabeledEdit)
@ -111,7 +111,7 @@ uses
procedure Register; procedure Register;
begin begin
{$I jlabeleddatetimeedit_icon.lrs} {$I jlabeleddatetimeedit_icon.lrs}
RegisterComponents('Additional',[TJLabeledDateTimeEdit]); RegisterComponents('Additional', [TJLabeledDateTimeEdit]);
end; end;
function TJLabeledDateTimeEdit.getFormat: string; function TJLabeledDateTimeEdit.getFormat: string;
@ -161,7 +161,7 @@ begin
Text := NormalizeDateTime(Text, theValue); Text := NormalizeDateTime(Text, theValue);
if (Length(bufText) > 0) and (Length(Text) = 0) then if (Length(bufText) > 0) and (Length(Text) = 0) then
begin begin
ShowMessage(bufText + ' no es una fecha-hora válida'); ShowMessage(Format(SInvalidDateTime, [bufText]));
SetFocus; SetFocus;
end end
else else
@ -172,7 +172,7 @@ begin
theValue := StrToDateTime(Text) theValue := StrToDateTime(Text)
else else
begin begin
ShowMessage(Text + ' no es una fecha-hora válida'); ShowMessage(Format(SInvalidDateTime, [Text]));
SetFocus; SetFocus;
end; end;
formatInput; formatInput;
@ -206,3 +206,4 @@ end;
end. end.

View File

@ -22,7 +22,8 @@ unit JLabeledFloatEdit;
interface interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics, Dialogs; Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics,
Dialogs, jinputconsts;
type type
@ -188,7 +189,7 @@ begin
theValue := StrToCurr(Text) theValue := StrToCurr(Text)
else else
begin begin
ShowMessage(Text + ' no es un valor válido'); ShowMessage(Format(SInvalidNumber, [Text]));
SetFocus; SetFocus;
end; end;
if fDecimals > 0 then if fDecimals > 0 then

View File

@ -22,7 +22,8 @@ unit JLabeledIntegerEdit;
interface interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics, Dialogs; Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics,
Dialogs, jinputconsts;
type type
@ -163,7 +164,7 @@ begin
theValue := StrToInt(Text) theValue := StrToInt(Text)
else else
begin begin
ShowMessage(Text + ' no es un valor válido'); ShowMessage(Format(SInvalidNumber, [Text]));
SetFocus; SetFocus;
end; end;
formatInput; formatInput;

View File

@ -23,14 +23,14 @@ interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics, Classes, SysUtils, LResources, Forms, Controls, ExtCtrls, Graphics,
Dialogs, jcontrolutils; Dialogs, jcontrolutils, jinputconsts;
type type
TJLabeledTimeEdit = class(TCustomLabeledEdit) TJLabeledTimeEdit = class(TCustomLabeledEdit)
private private
{ Private declarations } { Private declarations }
theValue: TTime; theValue: TTime;
hasValue: Boolean; hasValue: boolean;
fFormat: string; fFormat: string;
function getFormat: string; function getFormat: string;
function getValue: TTime; function getValue: TTime;
@ -108,7 +108,7 @@ implementation
procedure Register; procedure Register;
begin begin
{$I jlabeledtimeedit_icon.lrs} {$I jlabeledtimeedit_icon.lrs}
RegisterComponents('Additional',[TJLabeledTimeEdit]); RegisterComponents('Additional', [TJLabeledTimeEdit]);
end; end;
@ -131,7 +131,7 @@ end;
procedure TJLabeledTimeEdit.setValue(const AValue: TTime); procedure TJLabeledTimeEdit.setValue(const AValue: TTime);
begin begin
theValue := AValue; theValue := AValue;
hasValue:= True; hasValue := True;
formatInput; formatInput;
end; end;
@ -139,7 +139,8 @@ procedure TJLabeledTimeEdit.FormatInput;
begin begin
if hasValue then if hasValue then
Text := FormatDateTime(fFormat, theValue) Text := FormatDateTime(fFormat, theValue)
else Text := ''; else
Text := '';
end; end;
procedure TJLabeledTimeEdit.DoEnter; procedure TJLabeledTimeEdit.DoEnter;
@ -159,17 +160,17 @@ begin
if Length(Text) = 0 then if Length(Text) = 0 then
begin begin
theValue := 0; theValue := 0;
hasValue:= False; hasValue := False;
end end
else else
if IsValidTimeString(Text) then if IsValidTimeString(Text) then
begin begin
theValue := StrToTime(Text); theValue := StrToTime(Text);
hasValue:=True; hasValue := True;
end end
else else
begin begin
ShowMessage(Text + ' no es una hora válida'); ShowMessage(Format(SInvalidTime, [Text]));
SetFocus; SetFocus;
end; end;
formatInput; formatInput;
@ -188,7 +189,7 @@ begin
Text := ''; Text := '';
DisplayFormat := 'hh:mm:ss'; DisplayFormat := 'hh:mm:ss';
Value := 0; Value := 0;
hasValue:= True; hasValue := True;
end; end;
destructor TJLabeledTimeEdit.Destroy; destructor TJLabeledTimeEdit.Destroy;
@ -202,3 +203,4 @@ begin
end; end;
end. end.

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics, Classes, SysUtils, LResources, Forms, Controls, StdCtrls, Graphics,
Dialogs, jcontrolutils; Dialogs, jcontrolutils, jinputconsts;
type type
@ -16,7 +16,7 @@ type
private private
{ Private declarations } { Private declarations }
theValue: TTime; theValue: TTime;
hasValue: Boolean; hasValue: boolean;
fFormat: string; fFormat: string;
function getFormat: string; function getFormat: string;
function getValue: TTime; function getValue: TTime;
@ -121,7 +121,7 @@ end;
procedure TJTimeEdit.setValue(const AValue: TTime); procedure TJTimeEdit.setValue(const AValue: TTime);
begin begin
theValue := AValue; theValue := AValue;
hasValue:= True; hasValue := True;
formatInput; formatInput;
end; end;
@ -129,7 +129,8 @@ procedure TJTimeEdit.FormatInput;
begin begin
if hasValue then if hasValue then
Text := FormatDateTime(fFormat, theValue) Text := FormatDateTime(fFormat, theValue)
else Text := ''; else
Text := '';
end; end;
procedure TJTimeEdit.DoEnter; procedure TJTimeEdit.DoEnter;
@ -149,17 +150,17 @@ begin
if Length(Text) = 0 then if Length(Text) = 0 then
begin begin
theValue := 0; theValue := 0;
hasValue:= False; hasValue := False;
end end
else else
if IsValidTimeString(Text) then if IsValidTimeString(Text) then
begin begin
theValue := StrToTime(Text); theValue := StrToTime(Text);
hasValue:=True; hasValue := True;
end end
else else
begin begin
ShowMessage(Text + ' no es una hora válida'); ShowMessage(Format(SInvalidTime, [Text]));
SetFocus; SetFocus;
end; end;
formatInput; formatInput;
@ -178,7 +179,7 @@ begin
Text := ''; Text := '';
DisplayFormat := 'hh:mm:ss'; DisplayFormat := 'hh:mm:ss';
Value := 0; Value := 0;
hasValue:= True; hasValue := True;
end; end;
destructor TJTimeEdit.Destroy; destructor TJTimeEdit.Destroy;