Can I set a WebDialog Box to the screen center?
-
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)?
-
Yes, you should be able to do this with Javascript.
-
Thank you for immediate answer!
Would you like to clear some details:
-
How I can find the current screen resolution in this case?
-
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?
-
-
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
-
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!
-
@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?
-
@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.
-
I've moved this to the Tutorials section:
http://www.sketchucation.com/forums/scf/viewtopic.php?f=26&t=6067
-
@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.
Advertisement