Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » TrackPopupMenu() Msg Loop problem Collapse All
Subject Author Date
Neville Franks Feb 6, 2004 - 10:00 PM

Hi,
With the following code which I call from a OnRButtonUp() handler I run into problems if the user Right clicks while the menu is up. The Prof-UIS MsgLoop sends me another RightButtonUp and of course I have a problem as my code will try to display the menu again. ie. The code calls itself. I tried adding: TPM_RIGHTBUTTON but this appears to be ignored and I couldn’t find an equivelant TPMX_xx #define.


I could add code to my OnRButtonUp() handler to ignore the recursive call but this doesn’t seem like the correct solution, then again maybe it is!  I’d prefer a new TPMX_xxx #def that didn’t pass on mouse clicks or kbd msgs to the menu’s parent. Maybe you have another existing solution?


    DWORD dwTrackFlags = TPMX_DO_MESSAGE_LOOP | TPMX_NO_WM_COMMAND | TPMX_NO_CMD_UI | TPMX_NO_HIDE_RARELY;
    pPopupWnd->TrackPopupMenu( dwTrackFlags, point.x, point.y, NULL, NULL, NULL, &nResultCmdID );


Thanks,
Neville - http://www.surfulater.com

Technical Support Feb 7, 2004 - 9:16 AM

Dear Neville,

The Prof-UIS menu currently allows you to invoke its commands only with the left mouse button - you cannot do this with the right button (nothing happens). Furthermore, if you press down a menu item with the left button and then move away the mouse pointer over to some other window and release the mouse button, then it is that other window which receives the WM_RBUTTONUP message. We believe this behavior is acceptable.

Of course, we would process the right button click over a menu item in such a way that the related command will be invoked. Please let us know whether it is what you mean.

Neville Franks Feb 8, 2004 - 2:08 PM

Hi,
I think you misunderstood my problem. I’m not interested in enabling right click to work on menus. My problem is that when a menu is displayed using TrackPopupMenu() with the Flags I mentioned earlier the user can right click "outside" of the menu and my app gets the right click message. In my app right click is used to popup context menus, so now I get a second menu, when the user hasn’t finished with the first one and on it goes.


I’m reasonably sure this doesn’t happen with the Win32 API version of TrackPopupMenu() with the TPM_RETURNCMD flag.


Is there a way that I can detect if a popup menu is currently displayed? If so I can test this and not popup a second menu. Again not an ideal solution but it would do.


Thanks,
Neville

Technical Support Feb 10, 2004 - 9:29 AM

Dear Neville,


We try to get the behavior you are describing and failed. Please send us a sample application.