I assume that you mean a button that throws a menu when pressed.
You can also simply manually enter the code by clicking the mouse button to release TPopupMenu under it.
An example . Put something with TClickEvent (possibly TButton) and TPopupMenu in your form. Add some menu items. Then add the following OnClick event handler:
procedure TForm86.Button1Click(Sender: TObject); var button: TControl; lowerLeft: TPoint; begin if Sender is TControl then begin button := TControl(Sender); lowerLeft := Point(button.Left, button.Top + Button.Height); lowerLeft := ClientToScreen(lowerLeft); PopupMenu1.Popup(lowerLeft.X, lowerLeft.Y); end; end;
And viola! Just like magic. You can wrap it all in a component if you plan to reuse it. Perhaps even sell it online.
Note. . If you need a delay, then extract this code in another way, then set the OnClick timer and enable the OnMouseLeave timer. Then, if the timer fires, you can call the extracted method. Not sure how you do it when you press the keyboard. I do not know if Firefox supports etc.
Jim mckeeth
source share