Getting started with rack::ui::Menu

Hello! I’m contemplating using a menu for one of my modules but I don’t know how to get started. Much of the code that I can find (Squinky Labs being one) is somewhat overwhelming.

Could someone help me get started by explaining the bare minimum required for adding a menu to a module? (including code, if possible!)

Simplest one I could find was VCV Merge.

When you append override just write any menus in here e.g.

The createMenu() helper function from helpers.hpp creates and returns a new Menu at the current mouse position. You can add menu items with

MyMenuItem* item = new MyMenuItem;
menu->addChild(item);

If you instead want to add menu items to the module context menu, override ModuleWidget::appendContextMenu() as @Coirt said.

2 Likes

Thank you!