How to make a toolbar with a dropdown menu
-
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) -
Amazing work.. i like the toolbar"was that a webdialog?" Any examples or walkthroughs how to make a similar one?
-
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? -
Unfortunately not.
I will try some google searches -
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 -
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
-
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?? -
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#p280151These are Windows only.
-
where do i find the file "Win32API"
It says "Error Loading File win32.rb
No such file to load -- Win32API" -
@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
-
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?
Advertisement