π‘ LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering
Download Trial
[solved] submenue in a submenue ??
-
hi,
i went thru the api and forum,
but did not find a clear syntax for a 2nd level submenue:plugins
ruby
submenue
sub_submenue
i know from ather rubies, that it is possible. but how?
thanx
stan -
The method
<Sketchup::Menu>.add_submenu(<String>) β <Sketchup::Menu>
is called on an existing upper-level menu and returns a submenu (which is of same type as any normal menu).
The method<Sketchup::Menu>.add_item(<UI:Command>) β <Fixnum>
is called on a menu (or sub- or subsubmenu) and adds a menu item.So of course you can apply the methods repeatedly, ie.
command = UI;;Command.new("a command"){ puts "command executed" } # Get a reference to one of SketchUp's top level menus; toplevel_menu = UI.menu("Plugins") # This is a Sketchup;;Menu! # And add an item; toplevel_menu.add_item(command) # Or add a submenu; submenu1 = toplevel_menu.add_submenu("first level submenu") # This gives again a menu! # And add again a submenu; submenu2 = submenu1.add_submenu("second level submenu") # And add an item; submenu2.add_item(command)
-
.. but for some reason (known only to the Trimble team,) the reference for submenus is only valid during the loading of the file.
-
got it!
thanx, works perfectly...
stan
Advertisement