amiga-mui / muidev

:mage_man: Magic User Interface (MUI) – Documentation+Releases

Home Page:http://muidev.de

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

afalkenhahn opened this issue · comments

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?

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.

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...