A kickass UI using WebDialogs and DHTML Suite.
-
Did you do the layout by hand-editing the HTML files or did you have layout software to drag and drop, cut and paste, edit colors, etc.?
Also, did you find any useful online resources for learning HTML and javascript or did you just try and figure it all out on your own?
Thanks for sharing this...
-
@unknownuser said:
Chris,
I am interested. Give us a guidance, please.
Thanks in advance.
TomaszI meant that if you wanted to build a dhtml suite dialog I would give you advice. Do you have a UI in mind?
Chris
-
@whaat said:
Did you do the layout by hand-editing the HTML files or did you have layout software to drag and drop, cut and paste, edit colors, etc.?
Also, did you find any useful online resources for learning HTML and javascript or did you just try and figure it all out on your own?
Thanks for sharing this...
I did it by hand. I looked and looked for a good layout editor and came up with nothing that was suitable.
Finally I bit the bullet and started doing the html code by hand. It wasnt nearly as bad as I expected. And I now kinda understand why none of the html layout tools are any good. Its more like writing code than a layout. BTW I use SCite as a html aware text editor).
The dialogs\simple.html example shows pretty much just the basics.
Chris
-
@cphillips said:
I meant that if you wanted to build a dhtml suite dialog I would give you advice.
Do you have a UI in mind?I meant if you could show us how you have connected html and Ruby. How you pass results back to Ruby.
Tomasz
-
@unknownuser said:
I meant if you could show us how you have connected html and Ruby. How you pass results back to Ruby.
TomaszAh. Well you don't need dhtml suite for that.
Here is the ruby code that launches a very simple html dialog:
def showVerySimple() #create dlg = UI;;WebDialog.new("VerySimple", true,"verysimple", 300, 300, 100, 50, true) fn= File.dirname(__FILE__)+'/verysimple.html' dlg.set_file fn dlg.show {} #show it #create a callback for anytime a value changes in the dialog. dlg.add_action_callback("ValueChanged") {|d,p| puts p } end
The "add_action_callback" code at the end allows the dialog to communicate with sketchup. The "puts p" will print out the name and value of a control that changed.
Here is the HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD> <title>Webdialog UI </title> </HEAD> <body> <div> <font color="blue">Checkboxes</font><br> <input type="checkbox" name="check-one" onClick="tellSketchup(this.name,this.checked)">One</input> <input type="checkbox" name="check-two" onClick="tellSketchup(this.name,this.checked)">Two<br></input> <input type="checkbox" name="check-three" onClick="tellSketchup(this.name,this.checked)">Three</input> <br> <font color="blue">Radio</font><br> <INPUT type=radio name="radio" value="radio-a" onClick="tellSketchup(this.value,this.checked)">Aye <INPUT type=radio name="radio" value="radio-b" onClick="tellSketchup(this.value,this.checked)">Bee <INPUT type=radio name="radio" value="radio-c" onClick="tellSketchup(this.value,this.checked)">See<br> </div> <script type="text/javascript"> function tellSketchup(name,value) { //this non-intuitive command will call the sketchup callback "ValueChanged" //with the name and value of the control that changed window.location='skp;ValueChanged@'+name +"="+ value; } </script> </body> </HTML>
The HTML creates three checkboxes and three radio buttons. Anytime a user clicks on a control (ie. changes it) the "onClick" code is called. In this case it calls a javascript function called "tellSketchup". That function simply passes the info to sketchup in the form of a string like "check-one=true".
Thats it!
Chrishttp://www.sketchucation.com/forums/scf/sas/Ruby/VerySimpleDialog.zip
-
It comes down to passing Strings from the javascript to the ruby callback by setting the window.location and using the skp: prefix.
// this is javascript window.location = "skp;somecallback"; // no paramters window.location = "skp;somecallback@" + someString;
# this is ruby dialog.add_action_callback("somecallback") do |d, a| # d is the dialog # a is the string passed after the @ in the javascript puts "somecallback called;#{a.inspect}" end
-
Can someone repost the VerySimpleDialog.zip file that was on this thread?
I'd like to have a look...
-
Fixed. Thanks for notifying.
-
Chris,
That's a very neat job and a damned good idea to enhance interactivity for some plugins requiring options and being context sensitive for actions (The Sketchup tool bar is actually very limited to interact efficiently and the button state management of Sketchup is simply buggy).
I guess this works for Mac too.
As soon as I can, I'll give it a try to regroup some commands of my plugins (Bezier, JPP, OOS, etc...) as it will be easier to show the options.
Fredo
PS: your dialog box is very esthetic. I like very much the design. And if you allow me, I will take some inspiration of it when I try one.
-
Thanks Fredo6. Feel free to copy any part of it.
@unknownuser said:
Chris,
That's a very neat job and a damned good idea to enhance interactivity for some plugins requiring options and being context sensitive for actions (The Sketchup tool bar is actually very limited to interact efficiently and the button state management of Sketchup is simply buggy).
I guess this works for Mac too.
As soon as I can, I'll give it a try to regroup some commands of my plugins (Bezier, JPP, OOS, etc...) as it will be easier to show the options.
Fredo
PS: your dialog box is very esthetic. I like very much the design. And if you allow me, I will take some inspiration of it when I try one.
Advertisement