You've already forked lazarus-ccr
spkToolbar: Update Actions demo to show the new TMenuButton. Patch by Husker (https://forum.lazarus.freepascal.org/index.php/topic,51552.msg379413.html#msg379413).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7732 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -3,7 +3,7 @@ object Form1: TForm1
|
||||
Height = 304
|
||||
Top = 248
|
||||
Width = 501
|
||||
Caption = 'Form1'
|
||||
Caption = 'TSpkToolbar demo'
|
||||
ClientHeight = 284
|
||||
ClientWidth = 501
|
||||
Menu = MainMenu
|
||||
@ -123,6 +123,41 @@ object Form1: TForm1
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object btnToggleMenuButton: TButton
|
||||
Left = 25
|
||||
Height = 25
|
||||
Top = 48
|
||||
Width = 225
|
||||
Caption = 'Toggle Menu Button'
|
||||
OnClick = btnToggleMenuButtonClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object BtnToggleMenuButtonDropdownArrow: TButton
|
||||
Left = 26
|
||||
Height = 25
|
||||
Top = 80
|
||||
Width = 223
|
||||
Caption = 'Toggle Menu Button dropdown arrow'
|
||||
OnClick = BtnToggleMenuButtonDropdownArrowClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 25
|
||||
Height = 15
|
||||
Top = 124
|
||||
Width = 113
|
||||
Caption = 'Menu button caption'
|
||||
ParentColor = False
|
||||
end
|
||||
object edMenuButtonCaption: TEdit
|
||||
Left = 149
|
||||
Height = 23
|
||||
Top = 120
|
||||
Width = 100
|
||||
OnEditingDone = edMenuButtonCaptionEditingDone
|
||||
TabOrder = 2
|
||||
Text = 'edMenuButtonCaption'
|
||||
end
|
||||
end
|
||||
object SpkToolbar1: TSpkToolbar
|
||||
Left = 0
|
||||
@ -170,6 +205,10 @@ object Form1: TForm1
|
||||
TabIndex = 3
|
||||
Images = ImageList
|
||||
LargeImages = LargeImageList
|
||||
MenuButtonCaption = 'Menu'
|
||||
MenuButtonDropdownMenu = StyleMenu
|
||||
ShowMenuButton = True
|
||||
OnMenuButtonClick = SpkToolbar1MenuButtonClick
|
||||
Tabs = (
|
||||
'SpkTab1'
|
||||
'SpkTab2'
|
||||
|
@ -32,8 +32,12 @@ type
|
||||
AcEditCopy: TEditCopy;
|
||||
AcEditCut: TEditCut;
|
||||
AcEditPaste: TEditPaste;
|
||||
btnToggleMenuButton: TButton;
|
||||
BtnToggleMenuButtonDropdownArrow: TButton;
|
||||
edMenuButtonCaption: TEdit;
|
||||
ImageList: TImageList;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
LargeImageList: TImageList;
|
||||
MainMenu: TMainMenu;
|
||||
MenuItem1: TMenuItem;
|
||||
@ -134,11 +138,15 @@ type
|
||||
procedure AcSaveExecute(Sender: TObject);
|
||||
procedure AcSaveNowExecute(Sender: TObject);
|
||||
procedure AcUnderlineExecute(Sender: TObject);
|
||||
procedure btnToggleMenuButtonClick(Sender: TObject);
|
||||
procedure BtnToggleMenuButtonDropdownArrowClick(Sender: TObject);
|
||||
procedure edMenuButtonCaptionEditingDone(Sender: TObject);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure ShowMoreOptionsButtonCheckboxClick(Sender: TObject);
|
||||
procedure SpkPane2MoreOptionsButtonClick(Sender: TObject);
|
||||
procedure SpkPane6MoreOptionsButtonClick(Sender: TObject);
|
||||
procedure SpkToolbar1MenuButtonClick(Sender: TObject);
|
||||
procedure StyleMenuClick(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
@ -255,6 +263,24 @@ begin
|
||||
Label1.Caption := '"Underline" clicked';
|
||||
end;
|
||||
|
||||
procedure TForm1.btnToggleMenuButtonClick(Sender: TObject);
|
||||
begin
|
||||
SpkToolbar1.ShowMenuButton := not SpkToolbar1.ShowMenuButton;
|
||||
end;
|
||||
|
||||
procedure TForm1.BtnToggleMenuButtonDropdownArrowClick(Sender: TObject);
|
||||
begin
|
||||
if SpkToolbar1.MenuButtonStyle = mbsCaption then
|
||||
SpkToolbar1.MenuButtonStyle := mbsCaptionDropdown
|
||||
else
|
||||
SpkToolbar1.MenuButtonStyle := mbsCaption;
|
||||
end;
|
||||
|
||||
procedure TForm1.edMenuButtonCaptionEditingDone(Sender: TObject);
|
||||
begin
|
||||
SpkToolbar1.MenuButtonCaption := edMenuButtonCaption.Text;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
begin
|
||||
if CanClose then
|
||||
@ -272,6 +298,7 @@ begin
|
||||
SetUserInterface(true);
|
||||
Label1.Caption := '';
|
||||
LoadFromIni;
|
||||
edMenuButtonCaption.Text := SpkToolbar1.MenuButtonCaption;
|
||||
end;
|
||||
|
||||
procedure TForm1.ShowMoreOptionsButtonCheckboxClick(Sender: TObject);
|
||||
@ -290,6 +317,11 @@ begin
|
||||
ShowMessage('You clicked the ''More options'' button of the "User interface" pane.');
|
||||
end;
|
||||
|
||||
procedure TForm1.SpkToolbar1MenuButtonClick(Sender: TObject);
|
||||
begin
|
||||
ShowMessage('You clicked on Menu Button.');
|
||||
end;
|
||||
|
||||
procedure TForm1.LoadFromIni;
|
||||
var
|
||||
ini: TCustomIniFile;
|
||||
@ -301,6 +333,9 @@ begin
|
||||
SetStyle(SpkToolbar1.Style);
|
||||
ShowMoreOptionsButtonCheckbox.Checked := ini.ReadBool('MainForm', 'ShowMoreOptionsButton', false);
|
||||
ShowMoreOptionsButtonCheckboxClick(nil);
|
||||
SpkToolbar1.ShowMenuButton := ini.ReadBool('MainForm', 'ShowMenuButton', false);
|
||||
SpkToolbar1.MenuButtonStyle := TSpkMenubuttonStyle(ini.ReadInteger('MainForm', 'MenuButtonStyle', 0));
|
||||
SpkToolbar1.MenuButtonCaption := ini.ReadString('MainForm', 'MenuButtonCaption', 'Menu');
|
||||
finally
|
||||
ini.Free;
|
||||
end;
|
||||
@ -337,6 +372,9 @@ begin
|
||||
ini.WriteBool('MainForm', 'RibbonInterface', AcRibbonGUI.Checked);
|
||||
ini.WriteInteger('MainForm', 'RibbonStyle', ord(SpkToolbar1.Style));
|
||||
ini.WriteBool('MainForm', 'ShowMoreOptionsButton', ShowMoreOptionsButtonCheckbox.Checked);
|
||||
ini.WriteBool('MainForm', 'ShowMenuButton', SpkToolbar1.ShowMenuButton);
|
||||
ini.WriteInteger('MainForm', 'MenuButtonStyle', ord(SpkToolbar1.MenuButtonStyle));
|
||||
ini.WriteString('MainForm', 'MenuButtonCaption', SpkToolbar1.MenuButtonCaption);
|
||||
finally
|
||||
ini.Free;
|
||||
end;
|
||||
|
Reference in New Issue
Block a user