Novice Ruby Questions - Regarding dropdown windows
-
Hello. I am new to ruby and sketchup and have been trying to learn. I had a question regarding drop down windows. I was looking at an example I found from T. Burch at ruby library depot called dropdown.rb, which was very helpful. In my experimenting I have been unable to figure out how could you make it so the dropdown windows are in say slot 2-4 instead of 1-3.
Here is his example:
require 'sketchup.rb' var1 = "Last Choice" inputbox1 = %w[Choice1 Choice2 Choice3 Choice4].join("|") inputbox2 = %w[Option1 Option2 Option3 Option4].join("|") inputbox3 = %w[Selection#1 Selection#2 Selection#3].join("|") array_of_dropdowns = [inputbox1, inputbox2, inputbox3] # An array of arrays if !@val1 then @val1 = "Choice1" end # Assigning instance variables, they are remembered each if !@val2 then @val2 = "Option2" end # time the script is run in a session. if !@val3 then @val3 = "Selection#3" end # These values must match one of the array values!!! if !@val4 then @val4 = 4 end # Otherwise, no value is displayed as a default choice. prompts = ["Choose your Choice", "Opt your Option", "Select your Selection ", "Enter a Number"] values = [@val1, @val2, @val3, @val4] @val1, @val2, @val3, @val4 = inputbox prompts,values, array_of_dropdowns, "Multi-Drop Down Example" print "variable @val1 is ", @val1, "\n" print "variable @val2 is ", @val2, "\n" print "variable @val3 is ", @val3, "\n" print "variable @val4 is ", @val4, "\n"Is it possible to make it so, enter number is at the top and then is followed by the three dropdown menus: choice, option, and selection? Any help would be greatly appreciated. Thank you in advance.
-
Did you figure it out? You just need to 1)put a blank filler in there to shift the original options down. And 2)rearrange your default values.
- array_of_dropdowns = ["", inputbox1, inputbox2, inputbox3]
- values = [@val4, @val1, @val2, @val3]
-Kwok
-
Yes I did thank you

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement