You've already forked lazarus-ccr
Add non db input example
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1944 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
398
components/jujiboutils/examples/testnodbinput/jinpututils.pas
Normal file
398
components/jujiboutils/examples/testnodbinput/jinpututils.pas
Normal file
@ -0,0 +1,398 @@
|
||||
unit jinpututils;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, StdCtrls, SysUtils;
|
||||
type
|
||||
|
||||
{ TJCurrencyCtrl }
|
||||
|
||||
TJCurrencyCtrl = class(TObject)
|
||||
private
|
||||
myEdit: TCustomEdit;
|
||||
theValue: Currency;
|
||||
fFormat : String;
|
||||
fDecimales : Integer;
|
||||
function getDecimales: integer;
|
||||
function getFormat: string;
|
||||
function getValue: Currency;
|
||||
procedure myEditEnter(Sender: TObject);
|
||||
procedure myEditExit(Sender: TObject);
|
||||
procedure formatInput;
|
||||
procedure setDecimales(const AValue: integer);
|
||||
procedure setFormat(const AValue: string);
|
||||
procedure OnKeyPress(Sender: TObject; var key : char);
|
||||
function redondear(const AValue: Currency; const NDecimales: Integer) : Currency;
|
||||
function IsValidFloat(const Value: string): Boolean;
|
||||
procedure setValue(const AValue: Currency);
|
||||
public
|
||||
property format : String read getFormat write setFormat;
|
||||
property decimales : Integer read getDecimales write setDecimales;
|
||||
property value : Currency read getValue write setValue;
|
||||
constructor Create(widget : TCustomEdit);
|
||||
constructor Create(widget : TCustomEdit ;aDecimals : Integer; aFormat : String);
|
||||
end;
|
||||
|
||||
{ TJIntegerCtrl }
|
||||
|
||||
TJIntegerCtrl = class(TObject)
|
||||
private
|
||||
myEdit: TCustomEdit;
|
||||
theValue: Integer;
|
||||
fFormat : String;
|
||||
function getFormat: string;
|
||||
function getValue: Integer;
|
||||
procedure myEditEnter(Sender: TObject);
|
||||
procedure myEditExit(Sender: TObject);
|
||||
procedure formatInput;
|
||||
procedure setFormat(const AValue: string);
|
||||
procedure OnKeyPress(Sender: TObject; var key : char);
|
||||
function IsValidInteger(const Value: string): Boolean;
|
||||
procedure setValue(const AValue: Integer);
|
||||
public
|
||||
property format : String read getFormat write setFormat;
|
||||
property value : Integer read getValue write setValue;
|
||||
constructor Create(widget : TCustomEdit);
|
||||
end;
|
||||
|
||||
{ TJDateCtrl }
|
||||
|
||||
TJDateCtrl = class(TObject)
|
||||
private
|
||||
myEdit: TCustomEdit;
|
||||
theValue: TDateTime;
|
||||
fFormat : String;
|
||||
function getFormat: string;
|
||||
function getValue: TDateTime;
|
||||
procedure myEditEnter(Sender: TObject);
|
||||
procedure myEditExit(Sender: TObject);
|
||||
procedure formatInput;
|
||||
procedure setFormat(const AValue: string);
|
||||
procedure OnKeyPress(Sender: TObject; var key : char);
|
||||
function IsValidDate(const Value: string): Boolean;
|
||||
procedure setValue(const AValue: TDateTime);
|
||||
public
|
||||
function isNull : Boolean;
|
||||
property format : String read getFormat write setFormat;
|
||||
property value : TDateTime read getValue write setValue;
|
||||
constructor Create(widget : TCustomEdit);
|
||||
end;
|
||||
|
||||
function replacechar(const s: string; ch1: char; ch2: char): string;
|
||||
function countchar(const s: string; ch: char): integer;
|
||||
procedure Split(const Delimiter: Char; Input: string; Strings: TStrings);
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
math,dateutils,Graphics,Dialogs;
|
||||
|
||||
|
||||
{ TJCurrencyCtrl }
|
||||
|
||||
function TJCurrencyCtrl.getDecimales: integer;
|
||||
begin
|
||||
result:= fDecimales;
|
||||
end;
|
||||
|
||||
function TJCurrencyCtrl.getFormat: string;
|
||||
begin
|
||||
result := fFormat;
|
||||
end;
|
||||
|
||||
function TJCurrencyCtrl.getValue: Currency;
|
||||
begin
|
||||
result := theValue;
|
||||
end;
|
||||
|
||||
procedure TJCurrencyCtrl.myEditEnter(Sender: TObject);
|
||||
begin
|
||||
myEdit.Caption:= FloatToStr(theValue);
|
||||
myEdit.SelectAll;
|
||||
end;
|
||||
|
||||
procedure TJCurrencyCtrl.myEditExit(Sender: TObject);
|
||||
begin
|
||||
if IsValidFloat(myEdit.Caption) then
|
||||
theValue:= StrToCurr(myEdit.Caption)
|
||||
else
|
||||
begin
|
||||
ShowMessage(myEdit.Caption + ' no es un valor válido');
|
||||
myEdit.SetFocus;
|
||||
end;
|
||||
theValue:= redondear(theValue, fDecimales);
|
||||
formatInput;
|
||||
end;
|
||||
|
||||
procedure TJCurrencyCtrl.formatInput;
|
||||
begin
|
||||
myEdit.Caption:= FormatFloat(format, theValue);
|
||||
end;
|
||||
|
||||
procedure TJCurrencyCtrl.setDecimales(const AValue: integer);
|
||||
begin
|
||||
// Poner decimales, redondear valor y mostrarlo
|
||||
if AValue >= 0 then
|
||||
fDecimales:= AValue;
|
||||
end;
|
||||
|
||||
procedure TJCurrencyCtrl.setFormat(const AValue: string);
|
||||
begin
|
||||
fFormat:= AValue;
|
||||
formatInput;
|
||||
end;
|
||||
|
||||
procedure TJCurrencyCtrl.OnKeyPress(Sender: TObject; var key: char);
|
||||
begin
|
||||
if (Key in ['.',',']) then Key := Decimalseparator;
|
||||
if (key = DecimalSeparator) and (Pos(key, myEdit.Caption) >0) then key := #0;
|
||||
if not (Key in ['0'..'9',DecimalSeparator,'+','-',#8,#9]) then Key := #0;
|
||||
if (Key = DecimalSeparator) and (fDecimales = 0) then Key := #0;
|
||||
end;
|
||||
|
||||
function TJCurrencyCtrl.redondear(const AValue: Currency;
|
||||
const NDecimales: Integer): Currency;
|
||||
begin
|
||||
redondear := round(AValue * power(10, NDecimales)) / power(10, NDecimales);
|
||||
end;
|
||||
|
||||
function TJCurrencyCtrl.IsValidFloat(const Value: string): Boolean;
|
||||
begin
|
||||
if StrToCurrDef(value, MaxCurrency) = MaxCurrency then Result := False
|
||||
else
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TJCurrencyCtrl.setValue(const AValue: Currency);
|
||||
begin
|
||||
theValue:= redondear(AValue, fDecimales);
|
||||
formatInput;
|
||||
end;
|
||||
|
||||
constructor TJCurrencyCtrl.Create(widget: TCustomEdit);
|
||||
begin
|
||||
myEdit:= widget;
|
||||
myEdit.OnEnter:= @myEditEnter;
|
||||
myEdit.OnExit:= @myEditExit;
|
||||
myEdit.OnKeyPress:= @OnKeyPress;
|
||||
myEdit.caption:= ''; // avoid prev input
|
||||
format:= '#,0.00 €';
|
||||
fDecimales:= 2;
|
||||
end;
|
||||
constructor TJCurrencyCtrl.Create(widget: TCustomEdit; aDecimals: Integer;
|
||||
aFormat: String);
|
||||
begin
|
||||
myEdit:= widget;
|
||||
myEdit.OnEnter:= @myEditEnter;
|
||||
myEdit.OnExit:= @myEditExit;
|
||||
myEdit.OnKeyPress:= @OnKeyPress;
|
||||
myEdit.caption:= ''; // avoid prev input
|
||||
format:= aFormat;
|
||||
fDecimales:= aDecimals;
|
||||
end;
|
||||
|
||||
|
||||
{ TJIntegerCtrl }
|
||||
|
||||
function TJIntegerCtrl.getFormat: string;
|
||||
begin
|
||||
Result := fFormat;
|
||||
end;
|
||||
|
||||
function TJIntegerCtrl.getValue: Integer;
|
||||
begin
|
||||
Result := theValue;
|
||||
end;
|
||||
|
||||
procedure TJIntegerCtrl.myEditEnter(Sender: TObject);
|
||||
begin
|
||||
myEdit.Caption:= IntToStr(theValue);
|
||||
myEdit.SelectAll;
|
||||
end;
|
||||
|
||||
procedure TJIntegerCtrl.myEditExit(Sender: TObject);
|
||||
begin
|
||||
if IsValidInteger(myEdit.Caption) then
|
||||
theValue:= StrToInt(myEdit.Caption)
|
||||
else
|
||||
begin
|
||||
ShowMessage(myEdit.Caption + ' no es un valor válido');
|
||||
myEdit.SetFocus;
|
||||
end;
|
||||
formatInput;
|
||||
end;
|
||||
|
||||
procedure TJIntegerCtrl.formatInput;
|
||||
begin
|
||||
myEdit.Caption:= FormatFloat(format, theValue);
|
||||
end;
|
||||
|
||||
procedure TJIntegerCtrl.setFormat(const AValue: string);
|
||||
begin
|
||||
fFormat:= AValue;
|
||||
formatInput;
|
||||
end;
|
||||
|
||||
procedure TJIntegerCtrl.OnKeyPress(Sender: TObject; var key: char);
|
||||
begin
|
||||
if not (Key in ['0'..'9',#8,#9,'-']) then Key := #0;
|
||||
end;
|
||||
|
||||
function TJIntegerCtrl.IsValidInteger(const Value: string): Boolean;
|
||||
begin
|
||||
if StrToIntDef(value, MaxInt) = MaxInt then
|
||||
Result := False
|
||||
else
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TJIntegerCtrl.setValue(const AValue: Integer);
|
||||
begin
|
||||
theValue:= AValue;
|
||||
formatInput;
|
||||
end;
|
||||
|
||||
constructor TJIntegerCtrl.Create(widget: TCustomEdit);
|
||||
begin
|
||||
myEdit:= widget;
|
||||
myEdit.OnEnter:= @myEditEnter;
|
||||
myEdit.OnExit:= @myEditExit;
|
||||
myEdit.OnKeyPress:= @OnKeyPress;
|
||||
myEdit.caption:= ''; // avoid prev input
|
||||
format:= '0';
|
||||
end;
|
||||
|
||||
{ TJDateCtrl }
|
||||
|
||||
function TJDateCtrl.getFormat: string;
|
||||
begin
|
||||
result := fFormat;
|
||||
end;
|
||||
|
||||
function TJDateCtrl.getValue: TDateTime;
|
||||
begin
|
||||
Result := theValue;
|
||||
end;
|
||||
|
||||
procedure TJDateCtrl.myEditEnter(Sender: TObject);
|
||||
begin
|
||||
if theValue <> 0 then
|
||||
myEdit.Caption:= FormatDateTime(format, theValue)
|
||||
else
|
||||
myEdit.Caption := '';
|
||||
myEdit.SelectAll;
|
||||
end;
|
||||
|
||||
procedure TJDateCtrl.myEditExit(Sender: TObject);
|
||||
begin
|
||||
if Length(myEdit.Caption) = 0 then
|
||||
theValue := 0
|
||||
else
|
||||
if IsValidDate(myEdit.Caption) then
|
||||
theValue:= StrToDate(myEdit.Caption)
|
||||
else
|
||||
begin
|
||||
ShowMessage(myEdit.Caption + ' no es una fecha válida');
|
||||
myEdit.SetFocus;
|
||||
end;
|
||||
formatInput;
|
||||
end;
|
||||
|
||||
procedure TJDateCtrl.formatInput;
|
||||
begin
|
||||
if theValue <> 0 then
|
||||
myEdit.Caption:= FormatDateTime(format, theValue);
|
||||
end;
|
||||
|
||||
procedure TJDateCtrl.setFormat(const AValue: string);
|
||||
begin
|
||||
fFormat:= AValue;
|
||||
formatInput;
|
||||
end;
|
||||
|
||||
procedure TJDateCtrl.OnKeyPress(Sender: TObject; var key: char);
|
||||
begin
|
||||
if not (Key in ['0'..'9',#8,#9, '.', '-', '/']) then Key := #0;
|
||||
end;
|
||||
|
||||
function TJDateCtrl.IsValidDate(const Value: string): Boolean;
|
||||
var
|
||||
texto : string;
|
||||
i : integer;
|
||||
d, m, y : word;
|
||||
begin
|
||||
Result := false;
|
||||
// normalize date
|
||||
texto:= myEdit.Caption;
|
||||
texto := replacechar(texto, '.', DateSeparator);
|
||||
texto := replacechar(texto, '-', DateSeparator);
|
||||
texto := replacechar(texto, '/', DateSeparator);
|
||||
i := countchar(texto, DateSeparator);
|
||||
decodedate(theValue, y, m, d);
|
||||
case i of
|
||||
1 : texto := texto + DateSeparator + inttostr(y);
|
||||
0 : texto := texto + DateSeparator + inttostr(m) + DateSeparator + inttostr(y);
|
||||
end;
|
||||
myEdit.Caption:= texto;
|
||||
// comprobar que la fecha es valida
|
||||
if StrToDateDef(texto, MaxDateTime) = MaxDateTime then
|
||||
Result := False
|
||||
else
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TJDateCtrl.setValue(const AValue: TDateTime);
|
||||
begin
|
||||
theValue:= AValue;
|
||||
formatInput;
|
||||
end;
|
||||
|
||||
function TJDateCtrl.isNull: Boolean;
|
||||
begin
|
||||
Result := theValue = 0;
|
||||
end;
|
||||
|
||||
constructor TJDateCtrl.Create(widget: TCustomEdit);
|
||||
begin
|
||||
myEdit:= widget;
|
||||
myEdit.OnEnter:= @myEditEnter;
|
||||
myEdit.OnExit:= @myEditExit;
|
||||
myEdit.OnKeyPress:= @OnKeyPress;
|
||||
myEdit.caption:= ''; // avoid prev input
|
||||
theValue:= now;
|
||||
format:= 'dd/mm/yyyy';
|
||||
end;
|
||||
|
||||
function replacechar(const s: string; ch1: char; ch2: char): string;
|
||||
var
|
||||
i : integer;
|
||||
begin
|
||||
result := s;
|
||||
for i := 1 to length(result) do
|
||||
if result[i] = ch1 then
|
||||
result[i] := ch2;
|
||||
end;
|
||||
|
||||
function countchar(const s: string; ch: char): integer;
|
||||
var
|
||||
i : integer;
|
||||
begin
|
||||
result := 0;
|
||||
for i := 1 to length(s) do
|
||||
if s[i] = ch then
|
||||
inc(result);
|
||||
end;
|
||||
|
||||
procedure Split(const Delimiter: Char; Input: string; Strings: TStrings) ;
|
||||
begin
|
||||
Assert(Assigned(Strings)) ;
|
||||
Strings.Clear;
|
||||
Strings.Delimiter := Delimiter;
|
||||
Strings.DelimitedText := Input;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
128
components/jujiboutils/examples/testnodbinput/main.lfm
Normal file
128
components/jujiboutils/examples/testnodbinput/main.lfm
Normal file
@ -0,0 +1,128 @@
|
||||
object Form1: TForm1
|
||||
Left = 334
|
||||
Height = 300
|
||||
Top = 239
|
||||
Width = 400
|
||||
ActiveControl = Edit2
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 300
|
||||
ClientWidth = 400
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
LCLVersion = '0.9.31'
|
||||
object Label1: TLabel
|
||||
Left = 8
|
||||
Height = 18
|
||||
Top = 40
|
||||
Width = 92
|
||||
Caption = 'Currency Input'
|
||||
ParentColor = False
|
||||
end
|
||||
object Edit2: TEdit
|
||||
Left = 136
|
||||
Height = 27
|
||||
Top = 37
|
||||
Width = 104
|
||||
Alignment = taRightJustify
|
||||
TabOrder = 0
|
||||
Text = 'Edit2'
|
||||
end
|
||||
object Edit3: TEdit
|
||||
Left = 136
|
||||
Height = 27
|
||||
Top = 64
|
||||
Width = 104
|
||||
Alignment = taRightJustify
|
||||
TabOrder = 1
|
||||
Text = 'Edit3'
|
||||
end
|
||||
object Edit4: TEdit
|
||||
Left = 136
|
||||
Height = 27
|
||||
Top = 91
|
||||
Width = 104
|
||||
Alignment = taRightJustify
|
||||
TabOrder = 2
|
||||
Text = 'Edit4'
|
||||
end
|
||||
object BitBtn1: TBitBtn
|
||||
Left = 304
|
||||
Height = 34
|
||||
Top = 256
|
||||
Width = 88
|
||||
Caption = '&Close'
|
||||
Kind = bkClose
|
||||
OnClick = BitBtn1Click
|
||||
TabOrder = 4
|
||||
end
|
||||
object LabeledEdit1: TLabeledEdit
|
||||
Left = 136
|
||||
Height = 27
|
||||
Top = 118
|
||||
Width = 104
|
||||
Alignment = taRightJustify
|
||||
EditLabel.AnchorSideLeft.Control = LabeledEdit1
|
||||
EditLabel.AnchorSideTop.Control = LabeledEdit1
|
||||
EditLabel.AnchorSideTop.Side = asrCenter
|
||||
EditLabel.AnchorSideRight.Control = LabeledEdit1
|
||||
EditLabel.AnchorSideBottom.Control = LabeledEdit1
|
||||
EditLabel.Left = 9
|
||||
EditLabel.Height = 18
|
||||
EditLabel.Top = 122
|
||||
EditLabel.Width = 124
|
||||
EditLabel.Caption = 'TLabeledEdit control'
|
||||
EditLabel.ParentColor = False
|
||||
LabelPosition = lpLeft
|
||||
TabOrder = 3
|
||||
Text = '123'
|
||||
end
|
||||
object LabeledEdit2: TLabeledEdit
|
||||
Left = 136
|
||||
Height = 27
|
||||
Top = 144
|
||||
Width = 104
|
||||
Alignment = taRightJustify
|
||||
EditLabel.AnchorSideLeft.Control = LabeledEdit2
|
||||
EditLabel.AnchorSideTop.Control = LabeledEdit2
|
||||
EditLabel.AnchorSideTop.Side = asrCenter
|
||||
EditLabel.AnchorSideRight.Control = LabeledEdit2
|
||||
EditLabel.AnchorSideBottom.Control = LabeledEdit2
|
||||
EditLabel.Left = 37
|
||||
EditLabel.Height = 18
|
||||
EditLabel.Top = 148
|
||||
EditLabel.Width = 96
|
||||
EditLabel.Caption = 'Integer number'
|
||||
EditLabel.ParentColor = False
|
||||
LabelPosition = lpLeft
|
||||
TabOrder = 5
|
||||
end
|
||||
object LabeledEdit3: TLabeledEdit
|
||||
Left = 136
|
||||
Height = 27
|
||||
Top = 176
|
||||
Width = 104
|
||||
EditLabel.AnchorSideLeft.Control = LabeledEdit3
|
||||
EditLabel.AnchorSideTop.Control = LabeledEdit3
|
||||
EditLabel.AnchorSideTop.Side = asrCenter
|
||||
EditLabel.AnchorSideRight.Control = LabeledEdit3
|
||||
EditLabel.AnchorSideBottom.Control = LabeledEdit3
|
||||
EditLabel.Left = 69
|
||||
EditLabel.Height = 18
|
||||
EditLabel.Top = 180
|
||||
EditLabel.Width = 64
|
||||
EditLabel.Caption = 'Date input'
|
||||
EditLabel.ParentColor = False
|
||||
LabelPosition = lpLeft
|
||||
TabOrder = 6
|
||||
end
|
||||
object Button1: TButton
|
||||
Left = 248
|
||||
Height = 27
|
||||
Top = 176
|
||||
Width = 44
|
||||
AutoSize = True
|
||||
Caption = 'Date?'
|
||||
OnClick = Button1Click
|
||||
TabOrder = 7
|
||||
end
|
||||
end
|
44
components/jujiboutils/examples/testnodbinput/main.lrs
Normal file
44
components/jujiboutils/examples/testnodbinput/main.lrs
Normal file
@ -0,0 +1,44 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TForm1','FORMDATA',[
|
||||
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'N'#1#6'Height'#3','#1#3'Top'#3#239#0#5'Wi'
|
||||
+'dth'#3#144#1#13'ActiveControl'#7#5'Edit2'#7'Caption'#6#5'Form1'#12'ClientHe'
|
||||
+'ight'#3','#1#11'ClientWidth'#3#144#1#8'OnCreate'#7#10'FormCreate'#9'OnDestr'
|
||||
+'oy'#7#11'FormDestroy'#10'LCLVersion'#6#6'0.9.31'#0#6'TLabel'#6'Label1'#4'Le'
|
||||
+'ft'#2#8#6'Height'#2#18#3'Top'#2'('#5'Width'#2'\'#7'Caption'#6#14'Currency I'
|
||||
+'nput'#11'ParentColor'#8#0#0#5'TEdit'#5'Edit2'#4'Left'#3#136#0#6'Height'#2#27
|
||||
+#3'Top'#2'%'#5'Width'#2'h'#9'Alignment'#7#14'taRightJustify'#8'TabOrder'#2#0
|
||||
+#4'Text'#6#5'Edit2'#0#0#5'TEdit'#5'Edit3'#4'Left'#3#136#0#6'Height'#2#27#3'T'
|
||||
+'op'#2'@'#5'Width'#2'h'#9'Alignment'#7#14'taRightJustify'#8'TabOrder'#2#1#4
|
||||
+'Text'#6#5'Edit3'#0#0#5'TEdit'#5'Edit4'#4'Left'#3#136#0#6'Height'#2#27#3'Top'
|
||||
+#2'['#5'Width'#2'h'#9'Alignment'#7#14'taRightJustify'#8'TabOrder'#2#2#4'Text'
|
||||
+#6#5'Edit4'#0#0#7'TBitBtn'#7'BitBtn1'#4'Left'#3'0'#1#6'Height'#2'"'#3'Top'#3
|
||||
+#0#1#5'Width'#2'X'#7'Caption'#6#6'&Close'#4'Kind'#7#7'bkClose'#7'OnClick'#7
|
||||
+#12'BitBtn1Click'#8'TabOrder'#2#4#0#0#12'TLabeledEdit'#12'LabeledEdit1'#4'Le'
|
||||
+'ft'#3#136#0#6'Height'#2#27#3'Top'#2'v'#5'Width'#2'h'#9'Alignment'#7#14'taRi'
|
||||
+'ghtJustify EditLabel.AnchorSideLeft.Control'#7#12'LabeledEdit1'#31'EditLabe'
|
||||
+'l.AnchorSideTop.Control'#7#12'LabeledEdit1'#28'EditLabel.AnchorSideTop.Side'
|
||||
+#7#9'asrCenter!EditLabel.AnchorSideRight.Control'#7#12'LabeledEdit1"EditLabe'
|
||||
+'l.AnchorSideBottom.Control'#7#12'LabeledEdit1'#14'EditLabel.Left'#2#9#16'Ed'
|
||||
+'itLabel.Height'#2#18#13'EditLabel.Top'#2'z'#15'EditLabel.Width'#2'|'#17'Edi'
|
||||
+'tLabel.Caption'#6#20'TLabeledEdit control'#21'EditLabel.ParentColor'#8#13'L'
|
||||
+'abelPosition'#7#6'lpLeft'#8'TabOrder'#2#3#4'Text'#6#3'123'#0#0#12'TLabeledE'
|
||||
+'dit'#12'LabeledEdit2'#4'Left'#3#136#0#6'Height'#2#27#3'Top'#3#144#0#5'Width'
|
||||
+#2'h'#9'Alignment'#7#14'taRightJustify EditLabel.AnchorSideLeft.Control'#7#12
|
||||
+'LabeledEdit2'#31'EditLabel.AnchorSideTop.Control'#7#12'LabeledEdit2'#28'Edi'
|
||||
+'tLabel.AnchorSideTop.Side'#7#9'asrCenter!EditLabel.AnchorSideRight.Control'
|
||||
+#7#12'LabeledEdit2"EditLabel.AnchorSideBottom.Control'#7#12'LabeledEdit2'#14
|
||||
+'EditLabel.Left'#2'%'#16'EditLabel.Height'#2#18#13'EditLabel.Top'#3#148#0#15
|
||||
+'EditLabel.Width'#2'`'#17'EditLabel.Caption'#6#14'Integer number'#21'EditLab'
|
||||
+'el.ParentColor'#8#13'LabelPosition'#7#6'lpLeft'#8'TabOrder'#2#5#0#0#12'TLab'
|
||||
+'eledEdit'#12'LabeledEdit3'#4'Left'#3#136#0#6'Height'#2#27#3'Top'#3#176#0#5
|
||||
+'Width'#2'h EditLabel.AnchorSideLeft.Control'#7#12'LabeledEdit3'#31'EditLabe'
|
||||
+'l.AnchorSideTop.Control'#7#12'LabeledEdit3'#28'EditLabel.AnchorSideTop.Side'
|
||||
+#7#9'asrCenter!EditLabel.AnchorSideRight.Control'#7#12'LabeledEdit3"EditLabe'
|
||||
+'l.AnchorSideBottom.Control'#7#12'LabeledEdit3'#14'EditLabel.Left'#2'E'#16'E'
|
||||
+'ditLabel.Height'#2#18#13'EditLabel.Top'#3#180#0#15'EditLabel.Width'#2'@'#17
|
||||
+'EditLabel.Caption'#6#10'Date input'#21'EditLabel.ParentColor'#8#13'LabelPos'
|
||||
+'ition'#7#6'lpLeft'#8'TabOrder'#2#6#0#0#7'TButton'#7'Button1'#4'Left'#3#248#0
|
||||
+#6'Height'#2#27#3'Top'#3#176#0#5'Width'#2','#8'AutoSize'#9#7'Caption'#6#5'Da'
|
||||
+'te?'#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#7#0#0#0
|
||||
]);
|
86
components/jujiboutils/examples/testnodbinput/main.pas
Normal file
86
components/jujiboutils/examples/testnodbinput/main.pas
Normal file
@ -0,0 +1,86 @@
|
||||
unit main;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, jinpututils, Buttons, ExtCtrls, Spin, LCLType, EditBtn;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
BitBtn1: TBitBtn;
|
||||
Button1: TButton;
|
||||
Edit2: TEdit;
|
||||
Edit3: TEdit;
|
||||
Edit4: TEdit;
|
||||
Label1: TLabel;
|
||||
LabeledEdit1: TLabeledEdit;
|
||||
LabeledEdit2: TLabeledEdit;
|
||||
LabeledEdit3: TLabeledEdit;
|
||||
procedure BitBtn1Click(Sender: TObject);
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
campoImporte : TJCurrencyCtrl;
|
||||
campoLitros : TJCurrencyCtrl;
|
||||
campoGrados : TJCurrencyCtrl;
|
||||
campoEntero : TJIntegerCtrl;
|
||||
campoFecha : TJDateCtrl;
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
campoImporte:= TJCurrencyCtrl.Create(Edit2);
|
||||
campoLitros:= TJCurrencyCtrl.Create(Edit3, 2, '#,0.0000 L');
|
||||
campoGrados:= TJCurrencyCtrl.Create(LabeledEdit1);
|
||||
campoGrados.format:= '#,0.00 º';
|
||||
campoEntero:= TJIntegerCtrl.Create(LabeledEdit2);
|
||||
campoEntero.format := ',0 º';
|
||||
campoFecha := TJDateCtrl.Create(LabeledEdit3);
|
||||
end;
|
||||
|
||||
procedure TForm1.BitBtn1Click(Sender: TObject);
|
||||
begin
|
||||
Application.Terminate;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
begin
|
||||
if campoFecha.isNull then
|
||||
ShowMessage('No Date')
|
||||
else
|
||||
ShowMessage('has Date');
|
||||
end;
|
||||
|
||||
|
||||
procedure TForm1.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
campoImporte.Free;
|
||||
campoLitros.Free;
|
||||
campoGrados.Free;
|
||||
campoEntero.Free;
|
||||
campoFecha.Free;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I main.lrs}
|
||||
|
||||
end.
|
||||
|
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<General>
|
||||
<MainUnit Value="0"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<Language Value=""/>
|
||||
<CharSet Value=""/>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<DestinationDirectory Value="$(TestDir)/testnodbinput/"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="3">
|
||||
<Unit0>
|
||||
<Filename Value="testnuminput.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="testnuminput"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="main"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="jinpututils.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="jinpututils"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="10"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<UseAnsiStrings Value="False"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
@ -0,0 +1,23 @@
|
||||
program testnuminput;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}
|
||||
clocale,
|
||||
{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms
|
||||
{ you can add units after this }, main, LResources;
|
||||
|
||||
{$IFDEF WINDOWS}{$R testnuminput.rc}{$ENDIF}
|
||||
|
||||
begin
|
||||
{$I testnuminput.lrs}
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
5222
components/jujiboutils/examples/testnodbinput/testnuminput.lrs
Normal file
5222
components/jujiboutils/examples/testnodbinput/testnuminput.lrs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user