I added ActionQMenu and PathActionQMenu to jostMlib.
They are variations on ActionMenu and PathActionMenu, but use the Menu and MenuAction mechanisms. Because of this, some things that are available in ActionMenu and PathActionMenu could not be migrated, like keeping a menu open for more clicks. Also MenuAction does not pass mouse button or modifiers in its action, so those are out too. Also MenuAction.action passes different arguments than a ListView. I have included lots of examples though that make the usage clear.
PathActionQMenu will automatically traverse subdirectories, and has a lazyload option for large or deep directory trees.
Tag 1.1.26
As of 1.1.28, you can attach the menus to MainMenu.
See the code examples in the help files. Super easy.
1 Like
Tag1.1.31. Added convenience method *newMenuOnly for buttonless menus. So :
var menu;
FlowView.new.flow{|w| StaticText(w, 300@30).string_("Look at the macOS menu")};
menu=PathActionQMenu.newMenuOnly("Open Files and Dirs",
[
'An Action'->{|action,what,val|[action,what,val].postln},
Platform.userAppSupportDir++"/startup.scd", // opens a file
Platform.userAppSupportDir++"/*", // traverses a dir
],globalAction: {"globalAction".postln}, lazyLoad: true); // lazy load for deep directories.
menu.openAction= {|path,action,what,val|
[path,action,what,val].postln;
Document.open(path);
// Or use your custom editor
// ("open -a Sublime\\ Text "++path.escapeChar($ )).unixCmd;
};
// Add to MainMenu as a menu item
MainMenu.register(menu.menu, "TestPathActions");
// Or add all the menu actions to MainMenu
menunu.menu.actions.do{|act|
MainMenu.register(act, "TestPathActions2");
}
)
Tag1.1.32
Added a borderless_(true/false) option to ActionMenu and PathActionMenu .
This makes them look more like the ActionQMenu and PathActionQMenu, but keeps the old functionality. Only the Q-variants can be used with MainMenu.

