summaryrefslogtreecommitdiff
path: root/examples/gui/edits/edittest.lpr
diff options
context:
space:
mode:
Diffstat (limited to 'examples/gui/edits/edittest.lpr')
-rw-r--r--examples/gui/edits/edittest.lpr133
1 files changed, 133 insertions, 0 deletions
diff --git a/examples/gui/edits/edittest.lpr b/examples/gui/edits/edittest.lpr
new file mode 100644
index 00000000..82eb9a48
--- /dev/null
+++ b/examples/gui/edits/edittest.lpr
@@ -0,0 +1,133 @@
+program edittest;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Classes, fpgfx, gui_form, gui_label, gui_edit, gui_button, fpgui_package;
+
+type
+
+ TMainForm = class(TfpgForm)
+ private
+ procedure btnQuitClicked(Sender: TObject);
+ public
+ {@VFD_HEAD_BEGIN: MainForm}
+ lblName1: TfpgLabel;
+ edtText: TfpgEdit;
+ lblName2: TfpgLabel;
+ lblName3: TfpgLabel;
+ edtInteger: TfpgEditInteger;
+ edtFloat: TfpgEditFloat;
+ btnQuit: TfpgButton;
+ {@VFD_HEAD_END: MainForm}
+ procedure AfterCreate; override;
+ end;
+
+{@VFD_NEWFORM_DECL}
+
+
+
+{@VFD_NEWFORM_IMPL}
+
+procedure TMainForm.btnQuitClicked(Sender: TObject);
+begin
+ Close;
+end;
+
+procedure TMainForm.AfterCreate;
+begin
+ {@VFD_BODY_BEGIN: MainForm}
+ Name := 'MainForm';
+ SetPosition(363, 198, 271, 234);
+ WindowTitle := 'Edit components';
+ WindowPosition := wpScreenCenter;
+
+ lblName1 := TfpgLabel.Create(self);
+ with lblName1 do
+ begin
+ Name := 'lblName1';
+ SetPosition(8, 8, 196, 16);
+ FontDesc := '#Label1';
+ Text := 'Text Edit';
+ end;
+
+ edtText := TfpgEdit.Create(self);
+ with edtText do
+ begin
+ Name := 'edtText';
+ SetPosition(24, 28, 120, 22);
+ TabOrder := 1;
+ Text := '';
+ FontDesc := '#Edit1';
+ end;
+
+ lblName2 := TfpgLabel.Create(self);
+ with lblName2 do
+ begin
+ Name := 'lblName2';
+ SetPosition(8, 68, 80, 16);
+ FontDesc := '#Label1';
+ Text := 'Integer Edit';
+ end;
+
+ lblName3 := TfpgLabel.Create(self);
+ with lblName3 do
+ begin
+ Name := 'lblName3';
+ SetPosition(8, 124, 80, 16);
+ FontDesc := '#Label1';
+ Text := 'Float Edit';
+ end;
+
+ edtInteger := TfpgEditInteger.Create(self);
+ with edtInteger do
+ begin
+ Name := 'edtInteger';
+ SetPosition(24, 88, 120, 22);
+ end;
+
+ edtFloat := TfpgEditFloat.Create(self);
+ with edtFloat do
+ begin
+ Name := 'edtFloat';
+ SetPosition(24, 144, 120, 22);
+ end;
+
+ btnQuit := TfpgButton.Create(self);
+ with btnQuit do
+ begin
+ Name := 'btnQuit';
+ SetPosition(188, 200, 75, 24);
+ Text := 'Quit';
+ FontDesc := '#Label1';
+ ImageName := '';
+ TabOrder := 6;
+ OnClick := @btnQuitClicked;
+ end;
+
+ {@VFD_BODY_END: MainForm}
+end;
+
+
+procedure MainProc;
+var
+ frm: TMainForm;
+begin
+ fpgApplication.Initialize;
+ frm := TMainForm.Create(nil);
+ try
+ frm.Show;
+ fpgApplication.Run;
+ finally
+ frm.Free;
+ end;
+end;
+
+begin
+ MainProc;
+end.
+
+