Read_default webdialog position on OSX
-
Can one read that on mac ? (Doesn't work on windows registry)
Sketchup.read_default("WebDialog_whatever", "Left") -
There's no Ruby-side method to read a webdialog's position, you can just set its position.
You can get the window's position on the js-side, then pass that back to Ruby with a suitable callback...
Ruby-side:@dlg.add_action_callback('window_position'){|d, p| self.do_something_with_window_position(p) } ### def self.do_something_with_window_position(p) ### 'write_default' with 'p' as the string - e.g. "123,456" end ### just before making the dlg 'read_default' to get 'p' - e.g. "123,456" ### - use a default - say "20,20" if it is the first time, so no key/value... ### then... a = p.split(',') x = a[0].to_i y = a[1].to_i ### position the dlg thus; @dlg.set_position = x, yJS-side [jquery example]:
$(window).bind("beforeunload", function(e) { window.location = 'skp;window_position@'+(window.screen.left)+','+(window.screen.top); });So just before the window closes the callback gets the current x,y...
If you then store these with 'write_default' the dlg's window can be opened in the same position as last time on MAC [read_default] - it already is for a named dlg on the PC ?
-
I think I have a trick up my sleeve... but not on this machine...

-
Thanks TIG!
I was thinking about using something like that, but it has to consider the window border. -
@jiminy-billy-bob said:
it has to consider the window border.
macs don't have window borders...
available using vanilia.js from one of my webDialogs...
outerHeight; 370 outerWidth; 422 pageXOffset; 0 pageYOffset; 0 parent; Window parseFloat; function parseFloat() { parseInt; function parseInt() { personalbar; BarProp constructor; BarPropConstructor visible; false __proto__; BarPropPrototype screen; Screen availHeight; 1174 availLeft; 0 availTop; 22 availWidth; 1920 colorDepth; 24 constructor; ScreenConstructor height; 1200 pixelDepth; 24 width; 1920 __proto__; ScreenPrototype screenLeft; 100 screenTop; 420 screenX; 100 screenY; 420 scrollX; 0 scrollY; 0 scr
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement