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

Can I set a WebDialog Box to the screen center?

Scheduled Pinned Locked Moved Developers' Forum
9 Posts 4 Posters 1.9k 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.
  • A Offline
    alr
    last edited by alr 5 Feb 2008, 22:06

    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 5 Feb 2008, 22:08

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

      1 Reply Last reply Reply Quote 0
      • A Offline
        alr
        last edited by 5 Feb 2008, 22:17

        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 5 Feb 2008, 22:40

          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 6 Feb 2008, 00:21

            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 6 Feb 2008, 08:20

              @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 6 Feb 2008, 08:37

                @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 6 Feb 2008, 10:56

                  I've moved this to the Tutorials section:

                  301 Moved Permanently

                  favicon

                  (www.sketchucation.com)

                  Hi

                  1 Reply Last reply Reply Quote 0
                  • A Offline
                    alr
                    last edited by 7 Feb 2008, 06:45

                    @jim said:

                    I've moved this to the Tutorials section:

                    301 Moved Permanently

                    favicon

                    (www.sketchucation.com)

                    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
                    1 / 1
                    • First post
                      6/9
                      Last post
                    Buy SketchPlus
                    Buy SUbD
                    Buy WrapR
                    Buy eBook
                    Buy Modelur
                    Buy Vertex Tools
                    Buy SketchCuisine
                    Buy FormFonts

                    Advertisement