Ruby, sketchup-add another textbox to the unput box

447 views Asked by At

I am running this code through the ruby sketchup console.

            prompts = ["Stair Width", "Travel","Tread Thickness","Total Height","Riser Thickness","Stringer Width","Stringer Thickness","Top Hanger Thickness","Customer","Customer Address","Top Hanger Nose","Stair Nose","Flight"]
    defaults = [36.0,0.00,1.0,0.00,0.5,11.25,1.25,0.5,"My Builder", "234 Jimmys Street","Yes","Yes","Main"]
    list=["","","","","","","","","","", "Yes|No","Yes|No"]

    input = UI.inputbox prompts, defaults,list, "Stair Info"
        a,b,c,d,e,f,g,h,i,j,k,l,m=input
        cst=i.to_s
        adr=j.to_s
ent = Sketchup.active_model.entities
    tr=(d/8.0).ceil
    rise=d/tr
    run=((b-(1+h))/(tr-1))

I would like to add an additional textbox beside the "Total Height" input box and make it equal tr when exiting the "Total Height" input box. Is there a way to add a textbox beside the Total Height input box and have it equal "tr" once leaving the Total Height input box?

enter image description here

1

There are 1 answers

0
thomthom On

If you want to control the layout you need to create your own dialog. UI.inputbox doesn't give any control over this.

The other Ruby alternative for this in SketchUp is to use UI::HtmlDialog (from SketchUp 2017 and up; http://ruby.sketchup.com/UI/HtmlDialog.html) It uses an embedded Chromium control. If you need to support older versions of SketchUp you can use UI::WebDialog; http://ruby.sketchup.com/UI/WebDialog.html. UI::WebDialog uses the system browser available (IE on Windows, Safari/WebKit on Mac). You cannot be sure what version the user have installed though.

Some useful info about WebDialog can be found here: https://github.com/thomthom/sketchup-webdialogs-the-lost-manual/wiki

You can also try the SKUI project, it is a wrapper on top of WebDialog which let you create simple UI widgets using only Ruby code: https://github.com/thomthom/SKUI (It abstracts away the HTML/CSS code)