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

    How to make a toolbar with a dropdown menu

    Scheduled Pinned Locked Moved Developers' Forum
    12 Posts 4 Posters 4.2k Views 4 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.
    • M Offline
      morci429
      last edited by

      How to make a toolbar with a dropdown menu that has a list “faces_list=[]” that I created of certain faces

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        You can't create a native toolbar. The closest you get is making a WebDialog.
        I'm doing that with a plugin I'm currently working on: http://forums.sketchucation.com/viewtopic.php?f=323&t=32810 (see video)

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • M Offline
          morci429
          last edited by

          Amazing work.. i like the toolbar"was that a webdialog?" Any examples or walkthroughs how to make a similar one?

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            Yes it's a WebDialog. It's nothing more than a dropdown <SELECT> element and some Javascript to get the value from it.
            Have you got any HTML/CSS/JS experience?

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • M Offline
              morci429
              last edited by

              Unfortunately not.
              I will try some google searches

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                Have a look at beginner webdesigner tutorials.
                Then scan the notes and comments in this thread in regard to the WebDialog class: http://forums.sketchucation.com/viewtopic.php?f=180&t=23445

                Thomas Thomassen — SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • Dan RathbunD Offline
                  Dan Rathbun
                  last edited by

                  Your other option (perhaps only temporary to get things working for now,) is to use a popup dialog with a dropdown control.

                  def face_picker( facearray, default_face=0 )
                    #
                    face_string_array = facearray.collect {|e| e.to_s }
                    #
                    title    = ' Face Picker'
                    labels   = [ 'Choose a Face ;  ' ]
                    defaults = [ face_string_array[default_face] ]
                    values   = [ face_string_array.join('|') ]
                    #
                    result = UI.inputbox( labels, defaults, values, title )
                    #
                    if (result != nil) && (result != false) && (result != [])
                      # result will be an array, 1 member for each control
                      return facearray[ face_string_array.index( result[0] ) ]
                    else
                      return facearray[default_face]
                    end
                  
                  end # def method face_picker
                  
                  

                  Ref: UI.inputbox

                  I'm not here much anymore.

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    morci429
                    last edited by

                    Great help you guys, really thanks.
                    one more thing tho, how do i get rid of the sketchup logo on the top left corner of the webdialog and also the minimize and maximize buttons??

                    1 Reply Last reply Reply Quote 0
                    • Dan RathbunD Offline
                      Dan Rathbun
                      last edited by

                      See ThomThom's posts:

                      base code
                      http://forums.sketchucation.com/viewtopic.php?f=180&t=31213&start=30#p280148
                      additional code to suppress max & min buttons:
                      http://forums.sketchucation.com/viewtopic.php?f=180&t=31213&start=30#p280151

                      These are Windows only.

                      I'm not here much anymore.

                      1 Reply Last reply Reply Quote 0
                      • M Offline
                        morci429
                        last edited by

                        where do i find the file "Win32API"
                        It says "Error Loading File win32.rb
                        No such file to load -- Win32API"

                        1 Reply Last reply Reply Quote 0
                        • Dan RathbunD Offline
                          Dan Rathbun
                          last edited by

                          @morci429 said:

                          where do i find the file "Win32API"
                          It says "Error Loading File win32.rb
                          No such file to load -- Win32API"

                          I posted the two .so files that are distro'd with Ruby v1.8.6-p287, which is the version and patchlevel that Sketchup 8.x uses.

                          http://forums.sketchucation.com/download/file.php?id=54170

                          You can put them in any folder that can be found by the $LOAD_PATH array.

                          Most people just put them in their "Plugins" folder.

                          In your code, use a require statement:

                          begin
                            require('Win32API.so')
                          rescue LoadError => e
                            if e.message =~ /No such file to load/i
                              msg = "This plugin requires the Win32API.so file!"
                              msg<< "\n\nThis file cannot be found using the paths\n"
                              msg<< " in the $LOAD_PATH array."
                              UI.messagebox(msg)
                            else
                              raise
                            end
                          end
                          

                          I'm not here much anymore.

                          1 Reply Last reply Reply Quote 0
                          • G Offline
                            gabino
                            last edited by

                            hi guys, situation is the same with sketchup 2014?
                            i want to make a toolbar with organises approx. 50 tools (each tool is simply the link to a dynamic component). A drop-down menu in the toolbar would be I think best solution. Just like the one what appear in "Getting Started" toolbar.
                            I dont want to make the equivalent in webdialogs, it is possible but i think it would be a mess.
                            please, any ideas?

                            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