Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to force WFLG_RMBTRAP while using a menu at the same time? #330

Open
afalkenhahn opened this issue Mar 5, 2021 · 2 comments

Comments

@afalkenhahn
Copy link

I have a window that has a menustrip attached. The same window has a custom gadget for which I'd like to get MENUDOWN and MENUUP for IDCMP_MOUSEBUTTONS. Thus, I'm setting WFLG_RMBTRAP whenever the mouse is over the gadget and clear it when it's no longer over the gadget. However, that doesn't seem to work. It looks like MUI always clear WFLG_RMBTRAP. So is there any way to do what I want? e.g. have a menustrip in my window and be able to query right mouse up and down when the mouse is over my custom gadget?

@tboeckel
Copy link
Contributor

tboeckel commented Mar 6, 2021

I doubt this can be made possible. At least right now I have no idea how to do that. The point is that MUI must intercept the right mouse button clicks itself to make all kinds of popup menus possible (context menus, popup menus, etc). This leaves no room for custom handling of right mouse clicks. If there is no context menu attached to an object then all space is used to detect right mouse button clicks to handle the window's menu strip.

@tboeckel
Copy link
Contributor

I checked this issue once again and it might work, but I haven't checked this myself. But according to the source code this could work:

  • create an custom class which sets MUIA_ContextMenu = TRUE for its objects
  • implement MUIM_ContextMenuBuild and always return NULL

Whenenver MUIM_ContextMenuBuild is called you know that RMB was pressed over the object and your application can do what ever it likes to do for that case. No context menu will appear, because you don't create one.

However, it is not possible to be informed about the RMB release.

Perhaps you might want to give this approach a try...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants