Clocked does it, and it’s open source, so that may be a good place to look.
Having said that, the Rack v2 changelog has this:
“If Ctrl+clicking on any menu item, the menu stays open (except for some menu items like “Delete Module”).”
Yep - we all get the feature for free. I have been using menu Ctrl-click for a while now. For example, it is a nice way to quickly cycle through various context menu options for testing. Or for demo purposes, to cycle through context menu over-sampling options to show the effect it has - It is nice for the viewer to see the selection after it has been made.
Is that a rack global setting or something a particular module did? I don’t see an option like that in rack or in the small number of modules I just looked at.
My memory summarized too much :-/. The menu closing behavior on click (and how to modify it) is documented here:
<rack>\include\ui\MenuItem.hpp
struct MenuItem : MenuEntry {
...
/** Override to handle behavior when user clicks the menu item.
Event is consumed by default. Unconsume to prevent the menu from being closed.
If Ctrl (Cmd on Mac) is held, the event is *not* pre-consumed, so if your menu must be closed, always consume the event.
*/
void onAction(const ActionEvent& e) override;
...
i just wanted to add my 2 cents on this, as it was recently brought to my attention by @Omri_Cohen that one of my modules wasn’t properly updating the menu when ctrl+clicking.
turns out i was previously using something like this:
I know I ran into this behavior before. I just can’t remember whether it was with one of my modules or not. I need to test my modules, and now I know how to fix the problem if I find it. Thanks!
My code was pretty outdated and didn’t use the shortcuts available these days. I updated all of my menu code to the “new” (more streamlined) code and it works great. Your replies have been super helpful, as always!