Display Dropdown menu programmatically

I'm using a TAdvToolBarButton with a dropdown menu. Is it possible to display the menu when the button is clicked? Currently, the dropdown menu only displays when the arrow is clicked. I have tried calling DoDropDown inside the OnClick event.

Can you try to call DoDropDown from the OnMouseUp event?

Hi Bruno,

Thank you for the suggestion.
Unfortunately, it is not working.
The event is being triggered because I just check with the debugger.
Any other ideas?

Can you isolate this and send a sample source project with which we can reproduce this here, so we have all details?

Hi Bruno,

Attached please find the requested project.
Project1.zip (35.5 KB)

Regards,

I checked it and a slightly different approach will be needed from the OnMouseUp event:

This works fine here:

procedure TForm1.AdvToolBarButton4MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  pt: TPoint;
begin
  pt := Point(AdvToolBarButton4.Left,AdvToolBarButton4.Top + AdvToolBarButton4.Height );
  pt := AdvToolBarButton4.ClientToScreen(pt);
  apm_TemplatesLoad.Popup(pt.X, pt.Y);
end;

Thank you. I will try it.

However, I noticed that if I use TAdvToolBarMenuButton instead of TAdvToolBarButton, then DoDropDown() works inside the OnClick Event

Since TAdvToolBarMenuButton was designed to show a popup menu, it is recommended to use this for convenience.