diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2013-03-21 14:48:47 +0000 |
---|---|---|
committer | David Laurence Emerson <dle3ab@angelbase.com> | 2013-05-28 00:42:49 -0700 |
commit | 75bf1cbd2a121fc46e3dd5fc633a24669b66d089 (patch) | |
tree | c35ee2f21a04a959d857554ee2f67ce8211c47fa | |
parent | e7da16a116d93ecc730e92d542e8a7398bea4672 (diff) | |
download | fpGUI-75bf1cbd2a121fc46e3dd5fc633a24669b66d089.tar.xz |
demo: Removed compiler warnings, and brought demo up to latest standards
- UI widgets are defined private
- cleaned up uses clause to remove compiler hints about unused units
- Added a new File|Add menu item, which also uses a command instance
-rw-r--r-- | examples/gui/command_interface/frm_main.pas | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/examples/gui/command_interface/frm_main.pas b/examples/gui/command_interface/frm_main.pas index bc330130..3a29bccf 100644 --- a/examples/gui/command_interface/frm_main.pas +++ b/examples/gui/command_interface/frm_main.pas @@ -9,19 +9,19 @@ unit frm_main; interface uses - SysUtils, Classes, fpg_base, fpg_main, fpg_edit, - fpg_widget, fpg_form, fpg_label, fpg_button, - fpg_listbox, fpg_memo, fpg_combobox, fpg_grid, - fpg_dialogs, fpg_checkbox, fpg_tree, fpg_trackbar, - fpg_progressbar, fpg_radiobutton, fpg_tab, fpg_menu, - fpg_panel; + SysUtils, + Classes, + fpg_base, + fpg_main, + fpg_form, + fpg_button, + fpg_memo, + fpg_menu; type TMainForm = class(TfpgForm) private - procedure CommandHandler(Sender: TObject); - public {@VFD_HEAD_BEGIN: MainForm} btnAdd: TfpgButton; memName1: TfpgMemo; @@ -29,6 +29,9 @@ type MainMenu: TfpgMenuBar; mnuFile: TfpgPopupMenu; {@VFD_HEAD_END: MainForm} + miAdd: TfpgMenuItem; + procedure CommandHandler(Sender: TObject); + public procedure AfterCreate; override; end; @@ -61,7 +64,7 @@ begin Name := 'MainForm'; SetPosition(293, 236, 284, 254); WindowTitle := 'Command Interface Test'; - WindowPosition := wpScreenCenter; + WindowPosition := wpOneThirdDown; btnAdd := TfpgButton.Create(self); with btnAdd do @@ -106,6 +109,7 @@ begin begin Name := 'mnuFile'; SetPosition(44, 72, 120, 20); + miAdd := AddMenuItem('Add Item', '', @CommandHandler); AddMenuItem('Quit', '', @CommandHandler); end; @@ -116,6 +120,7 @@ begin // instantiate the Command classes btnAdd.SetCommand(TAddCommand.Create(memName1)); btnQuit.SetCommand(TExitCommand.Create); + miAdd.SetCommand(btnAdd.GetCommand); // reuse exist command from btnAdd instance // The menu item File|Quit shares the command of btnQuit mnuFile.MenuItemByName('Quit').SetCommand(btnQuit.GetCommand); end; |