Article View: borland.public.cppbuilder.nativeapi
Article #306Re: Canceling a popup event
From: Remy Lebeau (TeamB)
Date: Wed, 04 Jun 2008 18:54
Date: Wed, 04 Jun 2008 18:54
32 lines
2067 bytes
2067 bytes
"Marc" <info@mawnet.com> wrote in message
news:48468254$1@newsgroups.borland.com...
> case WM_RBUTTONDOWN:
> TPoint PopupPoint;
> GetCursorPos(&PopupPoint);
> PopupMenu->Popup(PopupPoint.x,PopupPoint.y);
There is a well-known bug in the OS that causes such code to not dismiss the
menu correctly if the user clicks outside the menu without selecting an
item. To workaround that bug, you have to use this code instead:
case WM_RBUTTONDOWN:
{
TPoint PopupPoint;
GetCursorPos(&PopupPoint);
SetForegroundWindow(Handle); // <-- add this
PopupMenu->Popup(PopupPoint.x,PopupPoint.y);
PostMessage(Handle, WM_NULL, 0, 0); // <-- add this
break;
}
> But sometimes the user does not want to select an item, but just
> check which options are available.
> How can I close the popup again WITHOUT the user clicking an option ?
The user has to click somewhere outside the menu (once the above fix is in
place).
Gambit
Technical Details
Message-ID:
<4846e512$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<48468254$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5cc04c471f3ad2ba X-Google-Attributes: gid10cc67,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <48468254$1@newsgroups.borland.com> Subject: Re: Canceling a popup event Date: Wed, 4 Jun 2008 11:54:03 -0700 Lines: 34 Organization: Lebeau Software X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 207.178.157.90 Message-ID: <4846e512$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1212605714 207.178.157.90 (4 Jun 2008 11:55:14 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail