Re: WinPopupMenu using WinCreateWindow + WC_MENU



lpino wrote:
Ok, I left behind the creation problems and now I have another
problem. The popup, doesn't stay, it just goes away right away. In
fact maybe I never had a creation problem but the thing was so fast I
didn't see it coming on.

I have checked the Windows implementation and there is a difference in
the way the APIs react. The windows API doesn't return immediately
like WinPopupMenu does. I checked wxWindows implementation under OS/2
and they go into a loop inside WM_CONTEXTMENU until they recieve the
command (clicking on the menu.. I guess). I tried that but I get into
an infinite loop (expected), but there is no popup (unexpected).

Any ideas?

Unless the loop is processing window messages, this is quite expected. Your PM thread can only execute in one location at a time. It can't pre-empt itself. (This is why the 1/10th second rule exists for message processing.)

If you're going to create a loop, make a WinGetMsg/WinDispatchMsg loop which quits after it dispatches a WM_COMMAND to your menu. But I'd recommend just letting the window procedure return after popping up the menu and processing WM_COMMAND to dismiss the menu in a separate call to your window procedure. Or better yet, make use of WM_MENUEND.

--
[Reverse the parts of the e-mail address to reply.]
.



Relevant Pages

  • Re: WinPopupMenu using WinCreateWindow + WC_MENU
    ... The popup, doesn't stay, it just goes away right away. ... fact maybe I never had a creation problem but the thing was so fast I ... an infinite loop, but there is no popup. ... recommend just letting the window procedure return after popping up the ...
    (comp.os.os2.programmer.misc)
  • Re: WinPopupMenu using WinCreateWindow + WC_MENU
    ... The popup, doesn't stay, it just goes away right away. ... fact maybe I never had a creation problem but the thing was so fast I ... an infinite loop, but there is no popup. ... recommend just letting the window procedure return after popping up the ...
    (comp.os.os2.programmer.misc)
  • Re: WinPopupMenu using WinCreateWindow + WC_MENU
    ... The popup, doesn't stay, it just goes away right away. ... fact maybe I never had a creation problem but the thing was so fast I ... an infinite loop, but there is no popup. ... recommend just letting the window procedure return after popping up the ...
    (comp.os.os2.programmer.misc)
  • Re: watch for a pop-up window
    ... The only part I'm stuck on is knowing when the window has popped up. ... Start by writing yourself a loop, ... While the popup has not yet appeared, appactivate will ...
    (microsoft.public.scripting.vbscript)
  • Re: Iceweasel freezes and iceape vulnerabilities and instability
    ... popup is fixed in place within the browser window, ... the browser is doing its job; it is just possible to do some really ... Funny you mention this -- I don't think this is due to malicious code, ...
    (Debian-User)

Loading