sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Can I set a WebDialog Box to the screen center?

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 4 Posters 1.9k Views 4 Watching
    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.
    • A Offline
      alr
      last edited by alr

      Can I set the position of WebDialog Dialog Box to the center of the SCREEN (not to the view (viewport) center, but to the SCREEN center)?

      1 Reply Last reply Reply Quote 0
      • T Offline
        todd burch
        last edited by

        Yes, you should be able to do this with Javascript.

        1 Reply Last reply Reply Quote 0
        • A Offline
          alr
          last edited by

          Thank you for immediate answer!

          Would you like to clear some details:

          1. How I can find the current screen resolution in this case?

          2. I can use javascripts inside (later), but when I activate WebDialog Box I have to use coordinates at the beginning. How I can find coordinates on this "initial" stage?

          1 Reply Last reply Reply Quote 0
          • T Offline
            todd burch
            last edited by

            Google search engine is your friend.

            Read this, then apply that information to your HTML.

            http://www.mollerus.net/tom/blog/2007/10/javascript_for_centering_a_popup_window_to_the_scr.html

            1 Reply Last reply Reply Quote 0
            • W Offline
              wikii
              last edited by

              to all,
              I hava tried to get screen size using JavaScript in html with get_element_value methods,it can work in SU ruby panel.

              In html:

              @unknownuser said:

              <script language="javascript">
              document.write('<div style="display:none;" ><input type="text" name="textfield" id="screen_width" style="width:150px;" value="'+ screen.width + '" /></div>')</javascript>

              In rb program:

              @unknownuser said:

              $dlg.get_element_value "screen.width"

              when the program is running, $dlg.get_element_value "screen.width" always get nothing;but in ruby panel,$dlg.get_element_value "screen.width" return "1680",that's exact my screen width!

              1 Reply Last reply Reply Quote 0
              • A Offline
                alr
                last edited by

                @wikii said:

                to all,
                I hava tried to get screen size using JavaScript in html with get_element_value methods,it can work in SU ruby panel.

                In html:

                @unknownuser said:

                <script language="javascript">
                document.write('<div style="display:none;" ><input type="text" name="textfield" id="screen_width" style="width:150px;" value="'+ screen.width + '" /></div>')</javascript>

                In rb program:

                @unknownuser said:

                $dlg.get_element_value "screen.width"

                when the program is running, $dlg.get_element_value "screen.width" always get nothing;but in ruby panel,$dlg.get_element_value "screen.width" return "1680",that's exact my screen width!

                I have tried too, but I have some problems. Would you be so kind as to send the whole sources (html+rb), please?

                1 Reply Last reply Reply Quote 0
                • A Offline
                  alr
                  last edited by

                  @unknownuser said:

                  Google search engine is your friend.

                  Read this, then apply that information to your HTML.

                  http://www.mollerus.net/tom/blog/2007/10/javascript_for_centering_a_popup_window_to_the_scr.html

                  Thank you for this link.

                  I have got that I can activate WebDialog, show it and INSIDE html use Javascript for screen sizes obtaining and open the SECOND WebDialog window, using screensize information I have obtained. So I need the FIRST WebDialog for correct positioning of the SECOND WebDialog. Therefore I can set the right position of the SECOND Web Dialog box only.

                  But the task is to set the position of the FIRST Web Dialog box in the center of the screen. I can't understand how I can use Javascript before Web Dialog activation.

                  Sorry for my stupidity 😄. It may be very simple, but it is not clear to me yet.

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    Jim
                    last edited by

                    I've moved this to the Tutorials section:

                    http://www.sketchucation.com/forums/scf/viewtopic.php?f=26&t=6067

                    Hi

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      alr
                      last edited by

                      @jim said:

                      I've moved this to the Tutorials section:

                      http://www.sketchucation.com/forums/scf/viewtopic.php?f=26&t=6067

                      It works! Thank you very much for your assistance. I agree that your decision of WebDialog positioning problem must be in the Tutorial section - it’s very useful.

                      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