Dropdown menu button possible?

Is it possible to have a dropdown menubutton, like a button with an error, and when left clicked, it popup a popupmenu at the button location? The toolbutton shows such arrow, but it also will popup a dropdown area and show other controls in that area, unfortunately not a popup menu.

Hi,


You can always attach a popupmenu to the toolbar button. You can use a normal button for this, if you are seeking to avoid the dropdown menu?

I cant attach a popup menu to a TMSFNCToolBarButton, opnly a DropDown Control, but not a popup menu. Maybe the attached image can explain what I mean.

Its a button with an arrow, and when clicked with the left mousebutton, it dropdown a popup menu.
I cant see any control beside the Raize menu button, to do that.


You have full flexibility with the DropDownControl. With the following setup, you are able to achieve what you want. No, it is not a TPopupMenu, but a custom dropdown menu.



procedure TForm77.DoItemClick(Sender: TObject; AItem: TTMSFNCListBoxItem);
begin
  Log.d(AItem.Text + ' Clicked!');
  TMSFNCToolBarButton1.CloseDropDown;
end;


procedure TForm77.FormCreate(Sender: TObject);
var
  pnl: TTMSFNCListBox;
begin
  pnl := TTMSFNCListBox.Create(Self);
  pnl.Items.Add.Text := 'Load from file';
  pnl.Items.Add.Text := 'Load from Cloud Storage';
  pnl.OnItemClick := DoItemClick;


  TMSFNCToolBarButton1.DropDownKind := ddkDropDown;
  TMSFNCToolBarButton1.DropDownControl := pnl;
  TMSFNCToolBarButton1.DropDownHeight := 60;
end;

Thanks, but it behave different, it does not behave like a popup menu, where items are highlighted when the mouse is over them and so on. If it cant be, then thats ok, I will find another solution.