diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-08-19 12:18:54 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-08-19 12:18:54 +0200 |
commit | 8cece5f797c5139a8c8bf8c27a49cfcb0f69cd20 (patch) | |
tree | b7bbcf3ebb09a379a0ed6ce21cc8e05055b75828 /examples | |
parent | db111af3a9a5ae60a5aead39985c6c6ead6e58bb (diff) | |
download | fpGUI-8cece5f797c5139a8c8bf8c27a49cfcb0f69cd20.tar.xz |
Menu Test Demo improvements.
* Used Align property for menu, toolbar, statusbar etc.
* Toggling of Toolbar and Status Bar updates the client area size
* Toolbar now looks more like a modern toolbar with flat buttons
and dividers.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/gui/menutest/menutest.lpi | 9 | ||||
-rw-r--r-- | examples/gui/menutest/menutest.lpr | 92 |
2 files changed, 78 insertions, 23 deletions
diff --git a/examples/gui/menutest/menutest.lpi b/examples/gui/menutest/menutest.lpi index 522b9451..c3120df3 100644 --- a/examples/gui/menutest/menutest.lpi +++ b/examples/gui/menutest/menutest.lpi @@ -1,7 +1,7 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <Version Value="7"/> + <Version Value="8"/> <General> <Flags> <SaveOnlyProjectUnits Value="True"/> @@ -39,7 +39,12 @@ </Units> </ProjectOptions> <CompilerOptions> - <Version Value="8"/> + <Version Value="9"/> + <Parsing> + <SyntaxOptions> + <UseAnsiStrings Value="False"/> + </SyntaxOptions> + </Parsing> <Linking> <Debugging> <GenerateDebugInfo Value="True"/> diff --git a/examples/gui/menutest/menutest.lpr b/examples/gui/menutest/menutest.lpr index e4d40cf0..586a4387 100644 --- a/examples/gui/menutest/menutest.lpr +++ b/examples/gui/menutest/menutest.lpr @@ -28,13 +28,17 @@ type btnSave: TfpgButton; btnOpen: TfpgButton; btnAbout: TfpgButton; + pnlClient: TfpgBevel; edit1: TfpgEdit; Memo1: TfpgMemo; FFileSubMenu: TfpgPopupMenu; FEditSubMenu: TfpgPopupMenu; FEditSelectSubMenu: TfpgPopupMenu; FViewSubMenu: TfpgPopupMenu; + FDisabledSubMenu: TfpgPopupMenu; FHelpSubMenu: TfpgPopupMenu; + Bevel1: TfpgBevel; + Bevel2: TfpgBevel; {@VFD_HEAD_END: MainForm} procedure miExitClicked(Sender: TObject); procedure miMenuItemSelected(Sender: TObject); @@ -71,6 +75,7 @@ procedure TMainForm.miToolBarChecked(Sender: TObject); begin TfpgMenuItem(Sender).Checked := not TfpgMenuItem(Sender).Checked; ToolBar.Visible := not ToolBar.Visible; + Realign; Log('Check Menu for Toolbar toggled'); end; @@ -78,6 +83,7 @@ procedure TMainForm.miStatusBarChecked(Sender: TObject); begin TfpgMenuItem(Sender).Checked := not TfpgMenuItem(Sender).Checked; StatusBar.Visible := not StatusBar.Visible; + Realign; Log('Check Menu for Statusbar toggled'); end; @@ -92,21 +98,25 @@ begin end; procedure TMainForm.AfterCreate; +var + mi: TfpgMenuItem; begin {%region 'Auto-generated GUI code' -fold} {@VFD_BODY_BEGIN: MainForm} Name := 'MainForm'; - SetPosition(316, 169, 400, 200); + SetPosition(402, 189, 400, 200); WindowTitle := 'Menu Test'; Hint := ''; WindowPosition := wpOneThirdDown; + MinWidth := 300; + MinHeight := 100; FMenuBar := TfpgMenuBar.Create(self); with FMenuBar do begin Name := 'FMenuBar'; SetPosition(0, 0, 400, 24); - Anchors := [anLeft,anRight,anTop]; + Align := alTop; end; StatusBar := TfpgPanel.Create(self); @@ -114,12 +124,12 @@ begin begin Name := 'StatusBar'; SetPosition(0, 176, 400, 24); - Anchors := [anLeft,anRight,anBottom]; Alignment := taLeftJustify; FontDesc := '#Label1'; Hint := ''; Style := bsLowered; Text := 'This is the status bar...'; + Align := alBottom; end; Toolbar := TfpgBevel.Create(self); @@ -127,9 +137,10 @@ begin begin Name := 'Toolbar'; SetPosition(0, 24, 400, 29); - Anchors := [anLeft,anRight,anTop]; Hint := ''; + Style := bsLowered; Shape := bsBottomLine; + Align := alTop; end; btnQuit := TfpgButton.Create(Toolbar); @@ -138,67 +149,77 @@ begin Name := 'btnQuit'; SetPosition(4, 2, 24, 24); Text := ''; - Embedded := True; + Flat := True; FontDesc := '#Label1'; Hint := ''; ImageMargin := -1; ImageName := 'stdimg.quit'; - ImageSpacing := 0; TabOrder := 1; OnClick := @miExitClicked; + Focusable := False; end; btnSave := TfpgButton.Create(Toolbar); with btnSave do begin Name := 'btnSave'; - SetPosition(56, 2, 24, 24); + SetPosition(64, 2, 24, 24); Text := ''; - Embedded := True; + Flat := True; FontDesc := '#Label1'; Hint := ''; ImageMargin := -1; ImageName := 'stdimg.save'; - ImageSpacing := 0; TabOrder := 2; + Focusable := False; end; btnOpen := TfpgButton.Create(Toolbar); with btnOpen do begin Name := 'btnOpen'; - SetPosition(32, 2, 24, 24); + SetPosition(40, 2, 24, 24); Text := ''; - Embedded := True; + Flat := True; FontDesc := '#Label1'; Hint := ''; ImageMargin := -1; ImageName := 'stdimg.open'; - ImageSpacing := 0; TabOrder := 3; + Focusable := False; end; btnAbout := TfpgButton.Create(Toolbar); with btnAbout do begin Name := 'btnAbout'; - SetPosition(84, 2, 24, 24); + SetPosition(100, 2, 24, 24); Text := ''; - Embedded := True; + Flat := True; FontDesc := '#Label1'; Hint := ''; ImageMargin := -1; ImageName := 'stdimg.help'; - ImageSpacing := 0; TabOrder := 4; OnClick := @btnAboutClicked; + Focusable := False; + end; + + pnlClient := TfpgBevel.Create(self); + with pnlClient do + begin + Name := 'pnlClient'; + SetPosition(56, 56, 244, 116); + Hint := ''; + Shape := bsSpacer; + Align := alClient; end; - edit1 := TfpgEdit.Create(self); + edit1 := TfpgEdit.Create(pnlClient); with edit1 do begin Name := 'edit1'; - SetPosition(8, 62, 100, 24); + SetPosition(8, 4, 100, 24); ExtraHint := ''; Hint := ''; TabOrder := 6; @@ -206,11 +227,11 @@ begin FontDesc := '#Edit1'; end; - Memo1 := TfpgMemo.Create(self); + Memo1 := TfpgMemo.Create(pnlClient); with Memo1 do begin Name := 'Memo1'; - SetPosition(124, 60, 268, 108); + SetPosition(120, 4, 120, 108); Anchors := [anLeft,anRight,anTop,anBottom]; Hint := ''; Lines.Add('<= Text Edit has a popup menu too.'); @@ -275,6 +296,34 @@ begin AddMenuItem('Test Russian text -> Òåñò', '', @miMenuItemSelected); end; + FDisabledSubMenu := TfpgPopupMenu.Create(self); + with FDisabledSubMenu do + begin + Name := 'FDisabledSubMenu'; + SetPosition(264, 160, 120, 20); + AddMenuItem('I''m not enabled', '', nil); + end; + + Bevel1 := TfpgBevel.Create(Toolbar); + with Bevel1 do + begin + Name := 'Bevel1'; + SetPosition(32, 2, 5, 24); + Hint := ''; + Style := bsLowered; + Shape := bsLeftLine; + end; + + Bevel2 := TfpgBevel.Create(Toolbar); + with Bevel2 do + begin + Name := 'Bevel2'; + SetPosition(92, 2, 5, 24); + Hint := ''; + Style := bsLowered; + Shape := bsLeftLine; + end; + {@VFD_BODY_END: MainForm} {%endregion} @@ -282,8 +331,9 @@ begin FMenuBar.AddMenuItem('&File', nil).SubMenu := FFileSubMenu; FMenuBar.AddMenuItem('&Edit', nil).SubMenu := FEditSubMenu; FMenuBar.AddMenuItem('&View', nil).SubMenu := FViewSubMenu; - FMenuBar.AddMenuItem('&Windows', nil); - FMenuBar.AddMenuItem('&Disabled', nil).Enabled := False; + mi := FMenuBar.AddMenuItem('&Disabled', nil); + mi.Enabled := False; + mi.SubMenu := FDisabledSubMenu; FMenuBar.AddMenuItem('&Help', nil).SubMenu := FHelpSubMenu; end; |