Dialog.set_on_close
-
Here's a nasty thing I could use some help with.
I want to save some data
onbeforeunload
. I gavedialog.set_on_close
anexecute_script
for js to do that and call the savecallback
in ruby. That works fine when you close the dialog but not when you close Sketchup completely. If you thinkappObserver.onquit
would accommodate this I'll give that a whirl.Thanks.
-
@chrisglasier said:
If you think appObserver.onquit would accommodate this I'll give that a whirl.
If that won't work, try to catch the
unload
event in JS for the webdialog. -
@thomthom said:
@chrisglasier said:
If you think appObserver.onquit would accommodate this I'll give that a whirl.
If that won't work, try to catch the
unload
event in JS for the webdialog.Thanks but I don't understand what you mean - js can detect when another application closes?
-
@chrisglasier said:
Thanks but I don't understand what you mean - js can detect when another application closes?
No - but you can detect when the window containing the webpage closes.
But I'm not sure if it'll work with webdialogs - at least not attached to thewindow
object. But I'd put my money on<body onUnload="...">
.https://developer.mozilla.org/En/DOM/Window.onunload
http://www.w3schools.com/jsref/event_onunload.asp -
Thanks but onunload doesn't work. I will give the appObserver a try later on.
Advertisement