summaryrefslogtreecommitdiff
path: root/examples/gui/edits
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-31 07:50:41 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-31 07:50:41 +0000
commit20b131c3a90538e700e36d20a1bdb6bf4a7f8232 (patch)
tree1daad9b5bcfd23d7592270e30e045b553af9a492 /examples/gui/edits
parent30cca12715202b0d2344f48be2c6e3be276a815d (diff)
downloadfpGUI-20b131c3a90538e700e36d20a1bdb6bf4a7f8232.tar.xz
* Added a patch from Antonio add a basic Integer and Float edit component.
* I created a simple EditTest example showing the new components in action.
Diffstat (limited to 'examples/gui/edits')
-rw-r--r--examples/gui/edits/edittest.lpi52
-rw-r--r--examples/gui/edits/edittest.lpr133
-rw-r--r--examples/gui/edits/extrafpc.cfg5
3 files changed, 190 insertions, 0 deletions
diff --git a/examples/gui/edits/edittest.lpi b/examples/gui/edits/edittest.lpi
new file mode 100644
index 00000000..302cd2c1
--- /dev/null
+++ b/examples/gui/edits/edittest.lpi
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <PathDelim Value="/"/>
+ <Version Value="6"/>
+ <General>
+ <Flags>
+ <SaveOnlyProjectUnits Value="True"/>
+ </Flags>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <TargetFileExt Value=""/>
+ </General>
+ <VersionInfo>
+ <ProjectVersion Value=""/>
+ </VersionInfo>
+ <PublishOptions>
+ <Version Value="2"/>
+ <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="fpgui_package"/>
+ </Item1>
+ </RequiredPackages>
+ <Units Count="1">
+ <Unit0>
+ <Filename Value="edittest.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="edittest"/>
+ </Unit0>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Other>
+ <CustomOptions Value="-FUunits"/>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+</CONFIG>
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.
+
+
diff --git a/examples/gui/edits/extrafpc.cfg b/examples/gui/edits/extrafpc.cfg
new file mode 100644
index 00000000..073dc4b6
--- /dev/null
+++ b/examples/gui/edits/extrafpc.cfg
@@ -0,0 +1,5 @@
+-FUunits
+-Fu../../../lib
+-Xs
+-XX
+-CX