View Single Post
Old 07 October 2023, 08:18   #9
Steam Ranger
Registered User
 
Steam Ranger's Avatar
 
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 208
Quote:
Originally Posted by Olaf Barthel View Post
For me the downside to IDCMP_MENUVERIFY is that you have a more complex tool to contend with.

Intuition may notify you before it will transition into the menu rendering state. You will have to decide whether to let the menu rendering continue or not, you will also have to do this quickly before the default behaviour catches without you having a chance to make it something else. You may receive this message at a point when your window is no longer active (all input events are asynchronous by nature, as is Intuition's remit to react to these events), which makes this even more "unreliable".

I struggle to find a compelling use for the IDCMP_MENUVERIFY feature, really, except that Intuition is doing much of the work for you which you would otherwise have to do all by yourself, should you rely upon the WFLG_RMBTRAP flag to be set/cleared as needed.

Tinkering with WFLG_RMBTRAP is more easily accomplished. You clear the flag when the mouse position within your window requires that a right mouse button click reveals the menu, you set the flag otherwise. You do need to enable mouse movement reports with IDCMP_MOUSEMOVE just so that you can change the WFLG_RMBTRAP flag as needed. Note that due to how the events are processed, the user may click the right mouse button and fail to see the menu appearing. If the mouse is moved quickly, your program may not be able to update the WFLG_RMBTRAP flag state in sync with where the mouse pointer is when you process the event.



Only one single Window of a screen can have control over whether the menu is to appear if you use IDCMP_MENUVERIFY. If there is more than one, you may still see these events but may have no control over them if your Window is currently inactive.

The use IDCMP_MENUVERIFY worked very well for programs such as Deluxe Paint, which only ever opened a single Window on the Screen for painting or using the tool box/magnifier, etc.
Thanks for the summary. I realised the RMB trap is the only one that would work for me. I'm making a system where you have context menu zones in the window, so clicking on different things give different menus, but there are parts of the window that may have no zone and instead show the screen menu, so I will need to manually change the thing.

Again, thanks for your help.
Steam Ranger is offline  
 
Page generated in 0.04560 seconds with 11 queries