RV Remove custom Menu from Main Menu without deactivate MinorMode

Do you know if it is possible to remove/hide a menu entry from the main menu bar in RV without having the MinorMode associated deactivated ?

To clarify, and related to my other post, I have a MinorMode that opens a widget, that I'd like to keep activated at all time. And when the widget goes shown, it would put its menu in the main menu bar, but when hidden the menu would be hidden as well from the main menu bar.

I tried the defineModeMenu("myMode", nil) method in my overridden deactivate() method but the custom menu stays in the main menu bar. Same with the setMenu().I've seen there's a function buildMainMenu() in rvui, that maybe would be a hint to force the redraw of the main menu without my custom one, but to keep the other custom menus, I have to give them as args to this function and I have no idea how to get those.

5件のコメント

0

(Michael) Kessler
2018年05月09日 17:42

Hi Caroline,

You could use the defineMenuMode, but like you mention, to override the whole menu; you need the prior items. You can get around some of this by setting or unsetting the strict flag, but you still need to know the prior state.

You can hold on to a reference to your original menu before setting it, which would let you recompose it later.

However, what is the reason you'd like your mode to remain active all the time? If you want your mode to activate/deactivate and hide/show the menus associated with the activation/deactivation then the model you are trying to achieve is the standard model. You can further get some value out of that with a delay load of your package.

If you are wanting to keep your mode active all the time to be able to receive events, is it possible to write this as two minor modes? One to handle the transient state, and one to handle the persistent state?

You can make your own events that your other package can respond to. That way you are also not creating a direct dependency on the two code blocks and allowing yourself a way to have multiple plugins respond to a single event.