spktoolbar: Fix action AND click events firing if both are assigned. Clean up click events from actions demo.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6175 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-02-05 12:24:59 +00:00
parent fdee2dddbe
commit b12379211e
5 changed files with 18 additions and 27 deletions

View File

@ -417,8 +417,9 @@ procedure TSpkBaseButton.Click;
begin
// first call our own OnClick
if Assigned(FOnClick) then
FOnClick(Self);
// then trigger the Action
FOnClick(Self)
else
// otherwise trigger the action
if (not (csDesigning in ComponentState)) and (FActionLink <> nil) then
FActionLink.Execute(Self);
end;
@ -704,10 +705,10 @@ begin
begin
if FButtonKind in [bkButton, bkButtonDropdown, bkToggle] then
begin
Click;
FButtonState := bsBtnHottrack;
if Assigned(FToolbarDispatch) then
FToolbarDispatch.NotifyVisualsChanged;
Click;
end else
if FButtonKind = bkDropdown then
begin

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
@ -26,9 +26,10 @@
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default"/>
</Modes>
</RunParams>
<RequiredPackages Count="2">
<Item1>

View File

@ -161,7 +161,7 @@ object Form1: TForm1
Appearance.Element.ActiveInnerDarkColor = 961020
Appearance.Element.ActiveCaptionColor = 8405614
Appearance.Element.Style = esRounded
TabIndex = 4
TabIndex = 0
Images = ImageList
LargeImages = LargeImageList
Tabs = (
@ -234,7 +234,6 @@ object Form1: TForm1
Enabled = True
Action = AcOpen
Caption = 'Open file'
OnClick = AcOpenExecute
LargeImageIndex = 1
ButtonKind = bkButton
end
@ -243,7 +242,6 @@ object Form1: TForm1
Enabled = True
Action = AcSave
Caption = 'Save file'
OnClick = AcSaveExecute
LargeImageIndex = 2
ButtonKind = bkButton
end
@ -252,7 +250,6 @@ object Form1: TForm1
Enabled = True
Action = AcQuit
Caption = 'Quit program'
OnClick = AcQuitExecute
LargeImageIndex = 0
ButtonKind = bkButton
end
@ -321,7 +318,6 @@ object Form1: TForm1
Enabled = True
Action = AcEditCut
Caption = 'Cut'
OnClick = AcEditCutExecute
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = True
ImageIndex = 3
@ -334,7 +330,6 @@ object Form1: TForm1
Enabled = True
Action = AcEditCopy
Caption = 'Copy'
OnClick = AcEditCopyExecute
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = True
ImageIndex = 4
@ -347,7 +342,6 @@ object Form1: TForm1
Enabled = True
Action = AcEditPaste
Caption = 'Paste'
OnClick = AcEditPasteExecute
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = True
ImageIndex = 5
@ -423,7 +417,6 @@ object Form1: TForm1
Enabled = True
Action = AcBold
Caption = 'Bold'
OnClick = AcBoldExecute
GroupBehaviour = gbBeginsGroup
HideFrameWhenIdle = False
ImageIndex = 7
@ -436,7 +429,6 @@ object Form1: TForm1
Enabled = True
Action = AcItalic
Caption = 'Italic'
OnClick = AcItalicExecute
GroupBehaviour = gbContinuesGroup
HideFrameWhenIdle = False
ImageIndex = 8
@ -449,7 +441,6 @@ object Form1: TForm1
Enabled = True
Action = AcUnderline
Caption = 'Underline'
OnClick = AcUnderlineExecute
GroupBehaviour = gbEndsGroup
HideFrameWhenIdle = False
ImageIndex = 9
@ -462,7 +453,6 @@ object Form1: TForm1
Enabled = True
Action = AcLeftJustify
Caption = 'Left justify'
OnClick = AcLeftJustifyExecute
GroupBehaviour = gbBeginsGroup
HideFrameWhenIdle = False
ImageIndex = 10
@ -476,7 +466,6 @@ object Form1: TForm1
Enabled = True
Action = AcCenter
Caption = 'Centered'
OnClick = AcCenterExecute
GroupBehaviour = gbContinuesGroup
HideFrameWhenIdle = False
ImageIndex = 11
@ -490,7 +479,6 @@ object Form1: TForm1
Enabled = True
Action = AcRightJustify
Caption = 'Right justify'
OnClick = AcRightJustifyExecute
GroupBehaviour = gbEndsGroup
HideFrameWhenIdle = False
ImageIndex = 12
@ -565,7 +553,6 @@ object Form1: TForm1
Enabled = True
Action = AcClassicalGUI
Caption = 'Classical'
OnClick = AcClassicalGUIExecute
State = cbUnchecked
TableBehaviour = tbBeginsRow
end
@ -574,7 +561,6 @@ object Form1: TForm1
Enabled = True
Action = AcRibbonGUI
Caption = 'Ribbon'
OnClick = AcRibbonGUIExecute
Checked = True
State = cbChecked
TableBehaviour = tbBeginsRow
@ -604,7 +590,6 @@ object Form1: TForm1
Enabled = True
Action = AcSaveNow
Caption = 'Save now'
OnClick = AcSaveNowExecute
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = True
ImageIndex = 2
@ -617,7 +602,6 @@ object Form1: TForm1
Enabled = True
Action = AcAutoSave
Caption = 'Autosave'
OnClick = AcAutoSaveExecute
Checked = True
State = cbChecked
TableBehaviour = tbBeginsRow
@ -685,7 +669,6 @@ object Form1: TForm1
Enabled = True
Action = AcAbout
Caption = 'About...'
OnClick = AcAboutExecute
LargeImageIndex = 6
ButtonKind = bkButton
end
@ -1438,6 +1421,9 @@ object Form1: TForm1
0000000000000000000000000000000000000000002E00000033000000330000
002E000000000000000000000000
}
BitmapAdv = {
4C6900000000
}
end
object LargeImageList: TImageList
Height = 32
@ -2343,5 +2329,8 @@ object Form1: TForm1
0009000000030000000000000000000000000000000000000000000000000000
0000000000000000000000000000
}
BitmapAdv = {
4C6900000000
}
end
end

View File

@ -7,7 +7,7 @@ object AboutForm: TAboutForm
ClientHeight = 185
ClientWidth = 320
Position = poMainFormCenter
LCLVersion = '1.7'
LCLVersion = '1.9.0.0'
object Label1: TLabel
Left = 0
Height = 30
@ -57,7 +57,7 @@ object AboutForm: TAboutForm
Cancel = True
Caption = 'Close'
Default = True
ModalResult = 11
ModalResult = 1
TabOrder = 0
end
end