summaryrefslogtreecommitdiff
path: root/examples/apps/uidesigner/tests
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-09-08 15:01:34 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-09-08 15:01:34 +0000
commit26cb129aeae6c69b9d5ca670c0ecee67429f0861 (patch)
tree3cc1542516fd4b49f9300d99c86630504a11ff3a /examples/apps/uidesigner/tests
parente6d2ec50bb37d5b92703e1852b814c90dd4d3204 (diff)
downloadfpGUI-26cb129aeae6c69b9d5ca670c0ecee67429f0861.tar.xz
* GUI Designer: Minor changes and removed Boolean property editors for now. Will reinstate them later.
* GUI Designer: Added a sample project to show how you would add a Main Menu using the Designer and the Unknown component on the component palette.
Diffstat (limited to 'examples/apps/uidesigner/tests')
-rw-r--r--examples/apps/uidesigner/tests/frm_menutest.pas82
-rw-r--r--examples/apps/uidesigner/tests/menutest.lpi58
-rw-r--r--examples/apps/uidesigner/tests/menutest.lpr27
3 files changed, 167 insertions, 0 deletions
diff --git a/examples/apps/uidesigner/tests/frm_menutest.pas b/examples/apps/uidesigner/tests/frm_menutest.pas
new file mode 100644
index 00000000..2f145bd3
--- /dev/null
+++ b/examples/apps/uidesigner/tests/frm_menutest.pas
@@ -0,0 +1,82 @@
+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}
+ SetPosition(278, 186, 591, 274);
+ WindowTitle := 'frmMain';
+ WindowPosition := wpScreenCenter;
+
+ MainMenu := TfpgMenuBar.Create(self);
+ with MainMenu do
+ begin
+ SetPosition(0, 0, 592, 23);
+ Anchors := [anLeft,anRight,anTop];
+ end;
+
+ miFile := TfpgPopupMenu.Create(self);
+ with miFile do
+ begin
+ SetPosition(424, 44, 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
+ SetPosition(76, 156, 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/examples/apps/uidesigner/tests/menutest.lpi b/examples/apps/uidesigner/tests/menutest.lpi
new file mode 100644
index 00000000..63f36c63
--- /dev/null
+++ b/examples/apps/uidesigner/tests/menutest.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="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_package"/>
+ <MinVersion Minor="5" Valid="True"/>
+ </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/examples/apps/uidesigner/tests/menutest.lpr b/examples/apps/uidesigner/tests/menutest.lpr
new file mode 100644
index 00000000..80b985be
--- /dev/null
+++ b/examples/apps/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.
+
+