Howto send mouse-msg to ToolButton or DropDown-ToolButton Menu? lazarus / 31-LCL ---------------------------------------------------------------------- SunyD · 2010-07-25 13:30 Hello, i am writing Toolbarmenu-component.  A toolbar that can act as Mainmenu. I don't find out howto dropdown menuitem associated with toolbutton at runtime. With mouse-clicks it works. But I want open/close menus if mouse-moved like in MainMenu. I get at runtime which toolbutton is under mouse-cursor. Toolbutton.Click or  Toolbutton.Dispatch don't helps Howto send mouse-msg to ToolButton or DropDown-ToolButton Menu? ---------------------------------------------------------------------- SunyD · 2010-07-25 14:39 I can send mouse-message to toolbutton but the MenuItem doesn't popup. You must really click with your finger at your mouse-hardware to popup toolbutton menus  I give it up. ---------------------------------------------------------------------- Ocye · 2010-07-26 03:59 Can't you call popup() directly? ---------------------------------------------------------------------- SunyD · 2010-07-26 13:55 Quote from: Ocye on July 26, 2010, 05:59:55 amCan't you call popup() directly? To popup ToolButton's PopupMenu or MenuItem there is only one way: ToolButton.CheckMenuDropdown; You can create 1 MainMenu(File, Edit and Helpmenu with Subitems) and ToolBar with 3 ToolButtons. Associate each ToolButton.MenuItem property with File, Edit and Help menuitem. Then put 3 TButtons and call from TButtons.OnClick-Event ToolButton.CheckMenuDropDown-Function. It works because you click before with left Mouse Button on TButton. And now put a Timer and call in Timer.OnTimer Event ToolButton.CheckMenuDropDown it doesn't work. i.e: Popup Toolbutton Menus without clicking left-mouse-button: Code: [Select]procedure TForm1.Button4Click(Sender: TObject); begin   Timer1.Tag:=0;   Timer1.Enabled:=true; end; procedure TForm1.Timer1Timer(Sender: TObject); begin   case Timer1.Tag of    0: begin      //this works, it will popup because it's first menu      ToolBFileCat.CheckMenuDropdown;      Label1.Caption:='FileMenu';    end; //from hier the menus will not popup!!!    1: begin      Label1.Caption:='EditMenu';      //Added. Sending LButton-Msg to ToolBar to hide visible-menu. it works     PostMessage(ToolBar1.Handle, WM_LBUTTONDOWN, MK_LBUTTON, Longint(PointToSmallPoint(Point(-1,-1))));      Application.ProcessMessages;     //End test      ToolBEditCat.CheckMenuDropdown;    end;    2: begin      ToolBHelpCat.CheckMenuDropdown;      Label1.Caption:='HElpMenu';    end;    else begin      Timer1.Tag:=-1;      Timer1.Enabled:=false;      Label1.Caption:='Timer stopped';    end;   end;   Timer1.Tag:=Timer1.Tag+1; end;  I think there is a bug or i make mistake. I looked and don't find any bug in files: lcl/comctrls.pp lcl/include/toolbar.inc   -function TToolBar.CheckMenuDropdown lcl/include/toolbutton.inc   -procedure TToolButton.MouseUp   -function TToolButton.CheckMenuDropdown If anycone can popup ToolButton.MenuItem without clicking mousebutton (see Timer-Example up)  write it here please. ---------------------------------------------------------------------- SunyD · 2010-07-26 14:52 Same results with Delphi7. I think there is no bug in lcl. ---------------------------------------------------------------------- SunyD · 2010-09-22 19:14 Solved. For MenuToolbar look here: http://www.lazarus.freepascal.org/index.php/topic,10600.msg52405.html# msg52405