How to make a toolbar with a dropdown menu

How to make a toolbar with a dropdown menu

Postby morci429 » Tue Mar 22, 2011 7:23 am

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

morci429 
 

Re: How to make a toolbar with a dropdown menu

Postby thomthom » Tue Mar 22, 2011 9:26 am

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: viewtopic.php?f=323&t=32810 (see video)
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: How to make a toolbar with a dropdown menu

Postby morci429 » Tue Mar 22, 2011 10:13 am

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

morci429 
 

Re: How to make a toolbar with a dropdown menu

Postby thomthom » Tue Mar 22, 2011 11:17 am

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?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: How to make a toolbar with a dropdown menu

Postby morci429 » Tue Mar 22, 2011 12:55 pm

Unfortunately not.
I will try some google searches
0

morci429 
 

Re: How to make a toolbar with a dropdown menu

Postby thomthom » Tue Mar 22, 2011 12:59 pm

Have a look at beginner webdesigner tutorials.
Then scan the notes and comments in this thread in regard to the WebDialog class: viewtopic.php?f=180&t=23445
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: How to make a toolbar with a dropdown menu

Postby Dan Rathbun » Tue Mar 22, 2011 3:11 pm

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

Code: Select all
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
0
    I'm not here much anymore. But a PM will fire email notifications.
    User avatar
    Dan Rathbun 
    PluginStore Author
    PluginStore Author
     

    Re: How to make a toolbar with a dropdown menu

    Postby morci429 » Mon Apr 18, 2011 4:35 pm

    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??
    0

    morci429 
     

    Re: How to make a toolbar with a dropdown menu

    Postby Dan Rathbun » Mon Apr 18, 2011 4:45 pm

    0
      I'm not here much anymore. But a PM will fire email notifications.
      User avatar
      Dan Rathbun 
      PluginStore Author
      PluginStore Author
       

      Re: How to make a toolbar with a dropdown menu

      Postby morci429 » Mon Apr 18, 2011 5:07 pm

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

      morci429 
       

      Re: How to make a toolbar with a dropdown menu

      Postby Dan Rathbun » Mon Apr 18, 2011 6:02 pm

      morci429 wrote: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:
      Code: Select all
      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
      0
        I'm not here much anymore. But a PM will fire email notifications.
        User avatar
        Dan Rathbun 
        PluginStore Author
        PluginStore Author
         

        Re: How to make a toolbar with a dropdown menu

        Postby gabino » Tue Sep 09, 2014 11:28 am

        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?
        0

        gabino 
         

        SketchUcation One-Liner Adverts

        by Ad Machine » 5 minutes ago



        Ad Machine 
        Robot
         



         

        Return to Developers' Forum

        Who is online

        Users browsing this forum: No registered users and 7 guests

        Visit our sponsors: