• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Webdialog: html and rb example

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 2 Posters 1.1k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    confitex architure
    last edited by 17 Feb 2008, 21:22

    Hello,

    I'm hardly trying to open a webdialog that could send parameters to an entity in sketchup. This entity could be "as simple as creating a box" 😞 that would be defined from a html form (width, length, height).
    I can't get how to retrieve variables from html (or even what exactly to do from SU...)
    Has Someone an example of the simpliest webdialog use with both sources in .rb and .html?

    Thank you.

    Emmanuel

    1 Reply Last reply Reply Quote 0
    • T Offline
      todd burch
      last edited by 17 Feb 2008, 22:53

      I get 4 pages of hits on this forum for "webdialog". Did none of those give you a clue?

      1 Reply Last reply Reply Quote 0
      • C Offline
        confitex architure
        last edited by 17 Feb 2008, 23:31

        You are right, 4 pages that i read before posting it.
        but 4 pages mostly on how to center the webdialog window, it doesn't help.
        At least one inspired my new post,
        http://www.sketchucation.com/forums/scf/viewtopic.php?f=57&t=5958&p=35329&hilit=+webdialog#p35329
        But Koos' concern is far away from mine... At this moment I wouldn't mind if my webdialog would stay active, I simply want to communicate between a html file and sketchup using ruby.

        Any Idea?

        1 Reply Last reply Reply Quote 0
        • C Offline
          confitex architure
          last edited by 18 Feb 2008, 21:49

          Hello,

          I'm trying to take advantage of this code below, that I found here (Todd was right... well, almost)

          That's the html file

          
          <HTML>
          	<HEAD>
              <title>Webdialog UI </title>
              <style type="text/css">  
          	</style>
          	</HEAD>
          	<body> 
                  <div>
                  <p><font color="blue">Input</font><br>
          			<input type="text" name="myTextInput" size="24"></input>
          		</p>
          			<p><input type="submit" name="submitButtonName" onclick="tellSketchup(myTextInput.value)"></p>
          		</div>
             		<script type="text/javascript">           
                     
                     function tellSketchup(value)
                     {
                              //this non-intuitive command will call the sketchup function "ValueChanged"
                              //with the name and value of the control that changed
                         window.location='skp;ValueChanged@'+ value;
                     }
                 </script>
              </body>
          </HTML>
          
          

          and here is the .rb file

          
          def inputSimple()
              #create
              dlg = UI;;WebDialog.new("inputSimple", true,"inputsimple", 300, 300, 100, 50, true)
              fn= File.dirname(__FILE__)+'/inputsimple.html'
              dlg.set_file fn
              dlg.show {}
              
              dlg.add_action_callback("ValueChanged") {|d,p|
                      puts p 
          			dlg.close {}
          			}
          			
          end
          
          

          But I can't achieve what I'm looking for: getting integer from the webdialog and use it to draw a box (f.e)

          to do so i'm trying to

          • Call another def at the end of the inputSimple()
          • Use the input as a variable in this called def;
          • Use multiple inputs

          But I do not succeed.
          Can someone help?

          1 Reply Last reply Reply Quote 0
          • C Offline
            confitex architure
            last edited by 19 Feb 2008, 09:14

            Hello,

            So far, i've solved my problem to call a def by using,

            dialog.set_on_close { def_to_run }
            

            For the unique variable to use, I've inserted in the dlg.add_action_callback

            $insertinput = p
            

            and then convert my $insertinput.to_i (not sure if I must set my variable in global)

            So I still have no solution to manipulate more than one text string form my webdialog form.
            How could I get different and multiple text boxes to send to sketchup 3 or more different variables?

            Thanks!

            1 Reply Last reply Reply Quote 0
            • T Offline
              todd burch
              last edited by 19 Feb 2008, 12:57

              Try this search argument:

              Error 404 (Not Found)!!1

              favicon

              (groups.google.com)

              Todd

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              1 / 1
              • First post
                1/6
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement