sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Webdialog Question on .show

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 4 Posters 656 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.
    • K Offline
      kdasilva
      last edited by

      Hello, I was doing some testing with web dialogs and i came across something I was curious about.

      I opened a new WebDialog of a simple html saved locally, within that HTML I had a hyperlink to another HTML file in the same directory, they link worked fine so I closed it down. However when I told the ruby console to show the webdialog again it was still on the second HTML page.

      How does the webdialog know to open the second HTML file? It would seem it is storing its previous location somewhere, can anyone tell me where/how this works?

      Cheers,
      Korbin

      1 Reply Last reply Reply Quote 0
      • K Offline
        kwalkerman
        last edited by

        A webdialog is an object that presumably has variables of its own, one of them most likely being the current url.

        In order to show the start page every time you show the dialog, you can reset the html path either straight in ruby, (WebDialog.set_html), or you can use onfocus or onload in the html file to load information.

        --
        Karen

        1 Reply Last reply Reply Quote 0
        • K Offline
          kdasilva
          last edited by

          Thanks Karen,

          I understand what your saying, however I am a bit more curious on how does the webdialog deal with multiple HTML files, I am building a series of functions in a .js file that connects to a number of HTML files and each HTML file will will send and receive data to Sketchup. Can one webdialog object send and receive these commands to the correct page seeing how it seems to keep track of which page one is on? Or will things start to get a bit hairy

          Cheers
          Korbin

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            A webdialog is 'current' until you .close it when it is no longer visible.
            So if you re- .show it then it becomes visible gain, displaying the last used settings.
            To go back to the original settings you need to .close the first one and then make a new dialog with the same starting point and .show that.

            TIG

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              Make sure to read WebDialogs - The Lost Manual (by ThomThom)

              The webdialog is an instance of your custom WebDialog class. When you .close() the window, the instance object still exists, and when you .show() it your only opening up the window again.

              On PC you can use the block argument to do something in the javascript. (It is bugged on the Mac.)

              <span class="syntaxdefault">webwin</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">show </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault">  webwin</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">execute_script</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"window.location='startpage.html';"</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> <br /></span><span class="syntaxkeyword">}</span><span class="syntaxdefault"> </span>
              

              I'm not here much anymore.

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

              Advertisement