Board index » delphi » Left button to activate a properties menu?

Left button to activate a properties menu?

Quote
David Nieves wrote:

> In my application, the user can right-click on a TImage object in order to
> bring up a properties menu.  Writing this code was cake.  However, I wish to
> make it work so that the user can bring up the properties menu via the *LEFT*
> mouse button.  Is there an easy way to do this?

> Very gratefully yours,
> David

Here's a one-liner.  Put this in the MouseDown method of the TImage:

  PopupMenu1.Popup(Form1.ClientOrigin.X + X,Form1.ClientOrigin.Y + Y);

Where PopupMenu1 is the pop-up menu, and Form1 is the name of the form it
is contained on.  This line calls the Popup method of the menu, and
places it at the mouse location.

This is not "quite" perfect, as the pop-up menu does not immediately take
the focus of the mouse.  (You must click a second time to select and
option in the menu)  If anybody finds a better solution, would you please
advise?

Hope-this-helps!
Dominic

 

Re:Left button to activate a properties menu?


In my application, the user can right-click on a TImage object in order to
bring up a properties menu.  Writing this code was cake.  However, I wish to
make it work so that the user can bring up the properties menu via the *LEFT*
mouse button.  Is there an easy way to do this?

Very gratefully yours,
David

Other Threads