Board index » delphi » How to a TPopupMenu with left mouse button in TrayIcon

How to a TPopupMenu with left mouse button in TrayIcon

How can I get a TPopupMenu to disappear even if the user does not select an
item.?

There is no problem when I use the PopupMenu property, whats the
difference?

Mvh / Best regards
  Jesper Lauridsen
  E-mail: j...@post1.tele.dk
  Homepage: http://home1.inet.tele.dk/jel/index.html

 

Re:How to a TPopupMenu with left mouse button in TrayIcon


Quote
Jesper Lauridsen wrote:

> How can I get a TPopupMenu to disappear even if the user does not select an
> item.?

> There is no problem when I use the PopupMenu property, whats the
> difference?

> Mvh / Best regards
>   Jesper Lauridsen
>   E-mail: j...@post1.tele.dk
>   Homepage: http://home1.inet.tele.dk/jel/index.html

Do you mean like setting a ttimer to ditch the popup after X seconds?

--
--------------------------------------------
In theory, theory and practice are the same.
In practice, they are not.
--------------------------------------------
Bryan Valencia
Software Services - Making Windows Scream
WWW   : www.invsn.com/softserv/
email : bry...@thevision.net
--------------------------------------------

Re:How to a TPopupMenu with left mouse button in TrayIcon


Quote
"Jesper Lauridsen" <j...@post1.tele.dk> wrote:
>How can I get a TPopupMenu to disappear even if the user does not select an
>item.?
>There is no problem when I use the PopupMenu property, whats the
>difference?
>Mvh / Best regards
>  Jesper Lauridsen
>  E-mail: j...@post1.tele.dk
>  Homepage: http://home1.inet.tele.dk/jel/index.html

I had the same problem recently. I found that inserting the API call
        SetForegroundWindow(<WindowContainingPopupMenu>.Handle)
 immediately before the call to
        <WindowContainingPopupMenu>.PopupMenu1.Popup(X,Y)
sorted this one out.

I read somewhere that this call is actually _required_ by the API.

I also found that next time around you need to call
PopupMenu1.Popup(X,Y) _twice_ if the user dismissed the previous menu
invocation without making a selection. I wonder if you get the same
result/bug/feature ;-)

Hope this helps - let me know how you get on. (Email preferred)

Adam Redgewell
ad...@adamr.ftech.co.uk

Re:How to a TPopupMenu with left mouse button in TrayIcon


On 14 Feb 1997 00:08:41 GMT, "Jesper Lauridsen" <j...@post1.tele.dk>
wrote:

Quote
>How can I get a TPopupMenu to disappear even if the user does not select an
>item.?

>There is no problem when I use the PopupMenu property, whats the
>difference?

>Mvh / Best regards
>  Jesper Lauridsen
>  E-mail: j...@post1.tele.dk
>  Homepage: http://home1.inet.tele.dk/jel/index.html

It disappears when the user clicks on something else.  That's the way
Windows works.

Re:How to a TPopupMenu with left mouse button in TrayIcon


All you need to do is set focus back to your application like this
GetCursorPos(Pt);
fPopupMenu.Popup(Pt.X, Pt.Y);
{this stops the popup menu from lingering if we dont make a selection}
SetForegroundWindow(Application.Handle);

---
Regards
Tim Hyder
T...@onaustralia.com.au

Jesper Lauridsen <j...@post1.tele.dk> wrote in article
<01bc1a0b$463a0060$LocalHost@pentium-133>...

Quote
> How can I get a TPopupMenu to disappear even if the user does not select
an
> item.?

> There is no problem when I use the PopupMenu property, whats the
> difference?

> Mvh / Best regards
>   Jesper Lauridsen
>   E-mail: j...@post1.tele.dk
>   Homepage: http://home1.inet.tele.dk/jel/index.html

Other Threads