Hi there, I’m new to these forums so I hope I ask this well!
I’m working with a complex plugin that uses a WebDialog browser to select our company’s models. (Yes, we will be updating to HtmlDialog very soon )
The WebDialog was getting very slow when populated with lots of models, so we are moving more and more functionality to the dialog JS, and eliminating some Ruby callbacks. One of these was a function that called to Ruby to save the default icon size for our models every time a slider was changed. Now, the JS is handling the resizing, and I moved saving the default value to a set_on_close block on our dialog.
The problem I’m having is that #set_on_close doesn’t seem to fire when you quit SketchUp–only when you explicitly close the dialog. So if you open our dialog in SketchUp, move the slider around, and quit, without explicitly closing the dialog, the default isn’t saved. Our AppObserver is doing great for lots of things, but it doesn’t seem to be able to pull a value out from the dialog during its #onQuit–perhaps because the dialog has already been destroyed at that point.
Any insight on this would be very appreciated! Thanks.
Here’s what’s in our AppObserver:
class XxxxAppObserver < Sketchup::AppObserver . . . def onQuit asset_dialog = Core::get_asset_dialog js_command = 'getIconSize()' asset_dialog.execute_script(js_command.to_s) end
Here is the get_asset_dialog method referred to above. It is just fetching the dialog.
def self.get_asset_dialog() return @asset_dialog end