You've already forked lazarus-ccr
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:
@ -18,7 +18,7 @@
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Files Count="28">
|
||||
<Files Count="29">
|
||||
<Item1>
|
||||
<Filename Value="src/jdbintegeredit.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
@ -157,6 +157,10 @@
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="JDBLabeledFloatEdit"/>
|
||||
</Item28>
|
||||
<Item29>
|
||||
<Filename Value="src/jinputconsts.pas"/>
|
||||
<UnitName Value="jinputconsts"/>
|
||||
</Item29>
|
||||
</Files>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<RequiredPkgs Count="2">
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
17
components/jujiboutils/jujibo-utils/src/jinputconsts.pas
Normal file
17
components/jujiboutils/jujibo-utils/src/jinputconsts.pas
Normal 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.
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -25,7 +25,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, LResources, Controls, ExtCtrls, LCLType, Dialogs,
|
||||
SysUtils;
|
||||
SysUtils, jinputconsts;
|
||||
|
||||
type
|
||||
TJLabeledDateTimeEdit = class(TCustomLabeledEdit)
|
||||
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
@ -159,17 +160,17 @@ begin
|
||||
if Length(Text) = 0 then
|
||||
begin
|
||||
theValue := 0;
|
||||
hasValue:= False;
|
||||
hasValue := False;
|
||||
end
|
||||
else
|
||||
if IsValidTimeString(Text) then
|
||||
begin
|
||||
theValue := StrToTime(Text);
|
||||
hasValue:=True;
|
||||
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.
|
||||
|
||||
|
@ -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;
|
||||
@ -149,17 +150,17 @@ begin
|
||||
if Length(Text) = 0 then
|
||||
begin
|
||||
theValue := 0;
|
||||
hasValue:= False;
|
||||
hasValue := False;
|
||||
end
|
||||
else
|
||||
if IsValidTimeString(Text) then
|
||||
begin
|
||||
theValue := StrToTime(Text);
|
||||
hasValue:=True;
|
||||
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;
|
||||
|
Reference in New Issue
Block a user