sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [solved] submenue in a submenue ??

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 358 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • artmusicstudioA Offline
      artmusicstudio
      last edited by artmusicstudio

      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

      1 Reply Last reply Reply Quote 0
      • A Offline
        Aerilius
        last edited by

        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)
        
        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          .. but for some reason (known only to the Trimble team,) the reference for submenus is only valid during the loading of the file.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • artmusicstudioA Offline
            artmusicstudio
            last edited by

            got it!

            thanx, works perfectly...

            stan

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement