Show TActionToolBar sub-settings when a top-level button is pressed

I have a toolbar using TActionToolBar and TActionManager. The button has buttons that are available by clicking the down arrow located to the right of the button. Everything is controlled by VCL and works great.

I want to show sub-buttons when I press the top-level button. Now I need to click on the small arrow, but I would like the whole button to do the same.

Is it possible?

thanks

+4
source share
2 answers

It looks like you can use the DropDown control, which acts when the item is selected. Alternatively, just enter the code in the OnButtonClick method to simulate a down arrow.

0
source

I managed to get the following work for my project. I could not find a way to directly reference the button created in the ActionBar. However, the ActionComponent is set to a button that is created at runtime.

This, of course, had to be the action itself in order to connect to the main button on the action bar, where the children were attached.

procedure TReportPlugin.actMyDropdownExecute(Sender: TObject); var ActionButton: TCustomDropDownButton; begin inherited; if (Sender is TAction) then begin if (Sender as TAction).ActionComponent is TCustomDropDownButton then begin ActionButton := (Sender as TAction).ActionComponent as TCustomDropDownButton; ActionButton.DropDownClick; end; end; end; 
0
source

Source: https://habr.com/ru/post/1446323/


All Articles