summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-09-18 12:36:20 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-09-18 12:36:20 +0000
commit40017cfb19dc2b1a33c18d284a77a32f58d5184a (patch)
tree9925be5afafdf4ae8174bd234321f92970e7f2b9 /examples
parentc05f50235db45e54c3a581fe4d4eb3c49b453a22 (diff)
downloadfpGUI-40017cfb19dc2b1a33c18d284a77a32f58d5184a.tar.xz
* GUI Designer: Worked around the bug that crashed the Designer
when you load a form that contains a TfpgPageControl. * GUI Designer: Added a example project showing how you would design a for that contains a Page Control and a few TabSheets. The GUI Designer will be improved later to make it more WYSIWYG.
Diffstat (limited to 'examples')
-rw-r--r--examples/apps/uidesigner/tests/frm_menutest.pas12
-rw-r--r--examples/apps/uidesigner/tests/tabsheet_design.lpi58
-rw-r--r--examples/apps/uidesigner/tests/tabsheet_design.lpr30
-rw-r--r--examples/apps/uidesigner/tests/tabtest.pas226
-rw-r--r--examples/apps/uidesigner/vfdformparser.pas2
-rw-r--r--examples/apps/uidesigner/vfdwidgets.pas2
6 files changed, 324 insertions, 6 deletions
diff --git a/examples/apps/uidesigner/tests/frm_menutest.pas b/examples/apps/uidesigner/tests/frm_menutest.pas
index 2f145bd3..4f707e11 100644
--- a/examples/apps/uidesigner/tests/frm_menutest.pas
+++ b/examples/apps/uidesigner/tests/frm_menutest.pas
@@ -40,21 +40,24 @@ end;
procedure TfrmMain.AfterCreate;
begin
{@VFD_BODY_BEGIN: frmMain}
- SetPosition(278, 186, 591, 274);
+ Name := 'frmMain';
+ SetPosition(278, 186, 399, 142);
WindowTitle := 'frmMain';
WindowPosition := wpScreenCenter;
MainMenu := TfpgMenuBar.Create(self);
with MainMenu do
begin
- SetPosition(0, 0, 592, 23);
+ Name := 'MainMenu';
+ SetPosition(0, 0, 400, 23);
Anchors := [anLeft,anRight,anTop];
end;
miFile := TfpgPopupMenu.Create(self);
with miFile do
begin
- SetPosition(424, 44, 152, 24);
+ Name := 'miFile';
+ SetPosition(200, 48, 152, 24);
AddMenuItem('&New...', 'Ctrl-N', nil);
AddMenuItem('&Open...', 'Ctrl-O', nil);
AddMenuItem('-', '', nil);
@@ -64,7 +67,8 @@ begin
btnName1 := TfpgButton.Create(self);
with btnName1 do
begin
- SetPosition(76, 156, 75, 24);
+ Name := 'btnName1';
+ SetPosition(8, 112, 75, 24);
Text := 'Button';
FontDesc := '#Label1';
ImageName := 'stdimg.quit';
diff --git a/examples/apps/uidesigner/tests/tabsheet_design.lpi b/examples/apps/uidesigner/tests/tabsheet_design.lpi
new file mode 100644
index 00000000..57bd8a3a
--- /dev/null
+++ b/examples/apps/uidesigner/tests/tabsheet_design.lpi
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <PathDelim Value="/"/>
+ <Version Value="5"/>
+ <General>
+ <Flags>
+ <SaveOnlyProjectUnits Value="True"/>
+ </Flags>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <IconPath Value="./"/>
+ <TargetFileExt Value=""/>
+ <Title Value="project1"/>
+ </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="2">
+ <Unit0>
+ <Filename Value="tabsheet_design.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="tabsheet_design"/>
+ </Unit0>
+ <Unit1>
+ <Filename Value="tabtest.pas"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="tabtest"/>
+ </Unit1>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Other>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+</CONFIG>
diff --git a/examples/apps/uidesigner/tests/tabsheet_design.lpr b/examples/apps/uidesigner/tests/tabsheet_design.lpr
new file mode 100644
index 00000000..7acb50aa
--- /dev/null
+++ b/examples/apps/uidesigner/tests/tabsheet_design.lpr
@@ -0,0 +1,30 @@
+program tabsheet_design;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Classes, fpgfx, tabtest;
+
+
+procedure MainProc;
+var
+ frm: TfrmTabTest;
+begin
+ fpgApplication.Initialize;
+ frm := TfrmTabTest.Create(nil);
+ try
+ frm.Show;
+ fpgApplication.Run;
+ finally
+ frm.Free;
+ end;
+end;
+
+begin
+ MainProc;
+end.
+
+
diff --git a/examples/apps/uidesigner/tests/tabtest.pas b/examples/apps/uidesigner/tests/tabtest.pas
new file mode 100644
index 00000000..9355a6d2
--- /dev/null
+++ b/examples/apps/uidesigner/tests/tabtest.pas
@@ -0,0 +1,226 @@
+unit tabtest;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ SysUtils, Classes, gfxbase, fpgfx, gui_edit,
+ gfx_widget, gui_form, gui_label, gui_button,
+ gui_listbox, gui_memo, gui_combobox, gui_grid,
+ gui_dialogs, gui_checkbox, gui_tree, gui_trackbar,
+ gui_progressbar, gui_radiobutton, gui_tab, gui_menu,
+ gui_bevel;
+
+type
+
+ TfraGeneral = class(TfpgForm)
+ public
+ {@VFD_HEAD_BEGIN: fraGeneral}
+ lblName1: TfpgLabel;
+ edtName1: TfpgEdit;
+ memName1: TfpgMemo;
+ btnName1: TfpgButton;
+ {@VFD_HEAD_END: fraGeneral}
+ procedure AfterCreate; override;
+ end;
+
+
+ TfraAddress = class(TfpgForm)
+ public
+ {@VFD_HEAD_BEGIN: fraAddress}
+ edtName1: TfpgEdit;
+ lblName1: TfpgLabel;
+ lblName2: TfpgLabel;
+ lblName3: TfpgLabel;
+ cbName1: TfpgComboBox;
+ {@VFD_HEAD_END: fraAddress}
+ procedure AfterCreate; override;
+ end;
+
+
+ TfrmTabTest = class(TfpgForm)
+ private
+ procedure btnCloseClicked(Sender: TObject);
+ public
+ {@VFD_HEAD_BEGIN: frmTabTest}
+ pcName1: TfpgPageControl;
+ btnClose: TfpgButton;
+ {@VFD_HEAD_END: frmTabTest}
+
+ // these must be added manually for now, until the GUI Designer is improved.
+ tsGeneral: TfpgTabSheet;
+ tsAddress: TfpgTabSheet;
+ tsAccounts: TfpgTabSheet;
+ fraGeneral: TfraGeneral;
+ fraAddress: TfraAddress;
+ procedure AfterCreate; override;
+ end;
+
+
+{@VFD_NEWFORM_DECL}
+
+implementation
+
+{@VFD_NEWFORM_IMPL}
+
+procedure TfraAddress.AfterCreate;
+begin
+ {@VFD_BODY_BEGIN: fraAddress}
+ Name := 'fraAddress';
+ SetPosition(602, 485, 208, 127);
+ WindowTitle := 'fraAddress';
+
+ edtName1 := TfpgEdit.Create(self);
+ with edtName1 do
+ begin
+ Name := 'edtName1';
+ SetPosition(64, 32, 120, 22);
+ Text := '';
+ FontDesc := '#Edit1';
+ end;
+
+ lblName1 := TfpgLabel.Create(self);
+ with lblName1 do
+ begin
+ Name := 'lblName1';
+ SetPosition(4, 4, 156, 16);
+ Text := 'TabSheet - Address';
+ FontDesc := '#Label2';
+ end;
+
+ lblName2 := TfpgLabel.Create(self);
+ with lblName2 do
+ begin
+ Name := 'lblName2';
+ SetPosition(8, 36, 44, 16);
+ Text := 'Street';
+ FontDesc := '#Label1';
+ end;
+
+ lblName3 := TfpgLabel.Create(self);
+ with lblName3 do
+ begin
+ Name := 'lblName3';
+ SetPosition(8, 60, 48, 16);
+ Text := 'City';
+ FontDesc := '#Label1';
+ end;
+
+ cbName1 := TfpgComboBox.Create(self);
+ with cbName1 do
+ begin
+ Name := 'cbName1';
+ SetPosition(64, 56, 120, 23);
+ Items.Add('Somerset West');
+ Items.Add('Cape Town');
+ Items.Add('Durban');
+ Items.Add('Jo''burg');
+ Items.Add('Pretoria');
+ FontDesc := '#List';
+ FocusItem := 1;
+ end;
+
+ {@VFD_BODY_END: fraAddress}
+end;
+
+
+procedure TfraGeneral.AfterCreate;
+begin
+ {@VFD_BODY_BEGIN: fraGeneral}
+ Name := 'fraGeneral';
+ SetPosition(611, 290, 197, 165);
+ WindowTitle := 'fraGeneral';
+
+ lblName1 := TfpgLabel.Create(self);
+ with lblName1 do
+ begin
+ Name := 'lblName1';
+ SetPosition(4, 4, 212, 16);
+ Text := 'TabSheet - General';
+ FontDesc := '#Label2';
+ end;
+
+ edtName1 := TfpgEdit.Create(self);
+ with edtName1 do
+ begin
+ Name := 'edtName1';
+ SetPosition(12, 28, 144, 22);
+ Anchors := [anLeft,anRight,anTop];
+ Text := '';
+ FontDesc := '#Edit1';
+ end;
+
+ memName1 := TfpgMemo.Create(self);
+ with memName1 do
+ begin
+ Name := 'memName1';
+ SetPosition(12, 56, 172, 96);
+ Anchors := [anLeft,anRight,anTop,anBottom];
+ FontDesc := '#Edit1';
+ end;
+
+ btnName1 := TfpgButton.Create(self);
+ with btnName1 do
+ begin
+ Name := 'btnName1';
+ SetPosition(160, 28, 19, 20);
+ Anchors := [anRight,anTop];
+ Text := '...';
+ FontDesc := '#Label1';
+ ImageName := '';
+ ModalResult := 0;
+ end;
+
+ {@VFD_BODY_END: fraGeneral}
+end;
+
+procedure TfrmTabTest.btnCloseClicked(Sender: TObject);
+begin
+ Close;
+end;
+
+procedure TfrmTabTest.AfterCreate;
+begin
+ {@VFD_BODY_BEGIN: frmTabTest}
+ Name := 'frmTabTest';
+ SetPosition(293, 290, 275, 198);
+ WindowTitle := 'Tab Design Test';
+
+ pcName1 := TfpgPageControl.Create(self);
+ with pcName1 do
+ begin
+ Name := 'pcName1';
+ SetPosition(8, 12, 258, 148);
+ Anchors := [anLeft,anRight,anTop,anBottom];
+ FixedTabWidth := 0;
+ Style := tsTabs;
+ TabPosition := tpTop;
+ tsGeneral := AppendTabSheet('General');
+ tsAddress := AppendTabSheet('Address');
+ tsAccounts := AppendTabSheet('EAddress');
+ ActivePage := tsGeneral;
+ end;
+
+ btnClose := TfpgButton.Create(self);
+ with btnClose do
+ begin
+ Name := 'btnClose';
+ SetPosition(192, 168, 75, 24);
+ Anchors := [anRight,anBottom];
+ Text := 'Close';
+ FontDesc := '#Label1';
+ ImageName := '';
+ ModalResult := 0;
+ OnClick := @btnCloseClicked;
+ end;
+
+ {@VFD_BODY_END: frmTabTest}
+
+ fraGeneral := TfraGeneral.Create(tsGeneral);
+ fraGeneral.Align := alClient;
+ fraAddress := TfraAddress.Create(tsAddress);
+ fraAddress.Align := alClient;
+end;
+
+end.
diff --git a/examples/apps/uidesigner/vfdformparser.pas b/examples/apps/uidesigner/vfdformparser.pas
index 3f2f1eb8..9aba3587 100644
--- a/examples/apps/uidesigner/vfdformparser.pas
+++ b/examples/apps/uidesigner/vfdformparser.pas
@@ -268,7 +268,7 @@ begin
if lok then
begin
- //writeln('wg create: ',wgname,' (',wgclass,') - ',wgparent);
+// writeln('wg create: ',wgname,' (',wgclass,') - ',wgparent);
// searching for the parent ...
pwg := nil;
diff --git a/examples/apps/uidesigner/vfdwidgets.pas b/examples/apps/uidesigner/vfdwidgets.pas
index 59cef2d5..75d44741 100644
--- a/examples/apps/uidesigner/vfdwidgets.pas
+++ b/examples/apps/uidesigner/vfdwidgets.pas
@@ -353,7 +353,7 @@ begin
// PageControl
wc := TVFDWidgetClass.Create(TfpgPageControl);
wc.NameBase := 'pcName';
- wc.AddProperty('ActivePageIndex', TPropertyInteger, '');
+// wc.AddProperty('ActivePageIndex', TPropertyInteger, '');
// wc.AddProperty('BackgroundColor', TPropertyString, '');
wc.AddProperty('FixedTabWidth', TPropertyInteger, '');
// wc.AddProperty('SortPages', TPropertyInteger, 'Boolean value');