diff options
Diffstat (limited to 'uidesigner/tests')
-rw-r--r-- | uidesigner/tests/frm_menutest.pas | 86 | ||||
-rw-r--r-- | uidesigner/tests/menutest.lpi | 57 | ||||
-rw-r--r-- | uidesigner/tests/menutest.lpr | 27 | ||||
-rw-r--r-- | uidesigner/tests/tabsheet_design.lpi | 58 | ||||
-rw-r--r-- | uidesigner/tests/tabsheet_design.lpr | 30 | ||||
-rw-r--r-- | uidesigner/tests/tabtest.pas | 226 |
6 files changed, 484 insertions, 0 deletions
diff --git a/uidesigner/tests/frm_menutest.pas b/uidesigner/tests/frm_menutest.pas new file mode 100644 index 00000000..4f707e11 --- /dev/null +++ b/uidesigner/tests/frm_menutest.pas @@ -0,0 +1,86 @@ +unit frm_menutest; + +{$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; + +type + + TfrmMain = class(TfpgForm) + private + procedure miExitClicked(Sender: TObject); + public + {@VFD_HEAD_BEGIN: frmMain} + MainMenu: TfpgMenuBar; + miFile: TfpgPopupMenu; + btnName1: TfpgButton; + {@VFD_HEAD_END: frmMain} + + procedure AfterCreate; override; + end; + +{@VFD_NEWFORM_DECL} + +implementation + +{@VFD_NEWFORM_IMPL} + +procedure TfrmMain.miExitClicked(Sender: TObject); +begin + Close; +end; + +procedure TfrmMain.AfterCreate; +begin + {@VFD_BODY_BEGIN: frmMain} + Name := 'frmMain'; + SetPosition(278, 186, 399, 142); + WindowTitle := 'frmMain'; + WindowPosition := wpScreenCenter; + + MainMenu := TfpgMenuBar.Create(self); + with MainMenu do + begin + Name := 'MainMenu'; + SetPosition(0, 0, 400, 23); + Anchors := [anLeft,anRight,anTop]; + end; + + miFile := TfpgPopupMenu.Create(self); + with miFile do + begin + Name := 'miFile'; + SetPosition(200, 48, 152, 24); + AddMenuItem('&New...', 'Ctrl-N', nil); + AddMenuItem('&Open...', 'Ctrl-O', nil); + AddMenuItem('-', '', nil); + AddMenuItem('E&xit', 'Alt+F4', @miExitClicked); + end; + + btnName1 := TfpgButton.Create(self); + with btnName1 do + begin + Name := 'btnName1'; + SetPosition(8, 112, 75, 24); + Text := 'Button'; + FontDesc := '#Label1'; + ImageName := 'stdimg.quit'; + ModalResult := 0; + ShowImage := True; + OnClick := @miExitClicked; + end; + + {@VFD_BODY_END: frmMain} + + MainMenu.AddMenuItem('&File', nil).SubMenu := miFile; +end; + + +end. diff --git a/uidesigner/tests/menutest.lpi b/uidesigner/tests/menutest.lpi new file mode 100644 index 00000000..3f9b35ec --- /dev/null +++ b/uidesigner/tests/menutest.lpi @@ -0,0 +1,57 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="6"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value="./"/> + <TargetFileExt Value=""/> + <Title Value="menutest"/> + </General> + <VersionInfo> + <ProjectVersion Value=""/> + </VersionInfo> + <PublishOptions> + <Version Value="2"/> + <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_toolkit"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="menutest.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="menutest"/> + </Unit0> + <Unit1> + <Filename Value="frm_menutest.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="frm_menutest"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/uidesigner/tests/menutest.lpr b/uidesigner/tests/menutest.lpr new file mode 100644 index 00000000..80b985be --- /dev/null +++ b/uidesigner/tests/menutest.lpr @@ -0,0 +1,27 @@ +program menutest; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes, frm_menutest, fpgfx; + + + +procedure MainProc; +var + frm: TfrmMain; +begin + fpgApplication.Initialize; + frm := TfrmMain.Create(nil); + frm.Show; + fpgApplication.Run; +end; + +begin + MainProc; +end. + + diff --git a/uidesigner/tests/tabsheet_design.lpi b/uidesigner/tests/tabsheet_design.lpi new file mode 100644 index 00000000..2124c06d --- /dev/null +++ b/uidesigner/tests/tabsheet_design.lpi @@ -0,0 +1,58 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="6"/> + <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_toolkit"/> + </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/uidesigner/tests/tabsheet_design.lpr b/uidesigner/tests/tabsheet_design.lpr new file mode 100644 index 00000000..7acb50aa --- /dev/null +++ b/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/uidesigner/tests/tabtest.pas b/uidesigner/tests/tabtest.pas new file mode 100644 index 00000000..9355a6d2 --- /dev/null +++ b/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. |