Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
π« Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
How to avoid multiple instances of WebDialog?
-
Is there a way to avoid multiple WebDialog instances to open? I'm making some tests/learning how to handle JS and webdialogs and I observed that each time I load my webdialog.rb file, it opens a new window without affecting previous ones.
I'd like to force somehow just one window, or to close the old one when the new one is created.
Thanks. -
bit of a guess as i havent done anything with web dialogs before, but could you try and talk to the webdialog before you open a new one? that way you could test if ones already open then open a new one if necessary.
-
module MyDialog # Use a module variable to store one reference to your dialog @dialog = UI;;WebDialog.new("Show Google.com", true, "ShowGoogleDotCom", 739, 641, 150, 150, true); @dialog.set_url "http://www.google.com" def self.show_dialog # Now you can use that variable to check if it's already visible or not if @dialog.visible? @dialog.show else @dialog.bring_to_front end end end -
@thomthom said:
> module MyDialog > > # Use a module variable to store one reference to your dialog > @dialog = UI;;WebDialog.new("Show Google.com", true, > "ShowGoogleDotCom", 739, 641, 150, 150, true); > @dialog.set_url "http://www.google.com" > > def self.show_dialog > # Now you can use that variable to check if it's already visible or not > if @dialog.visible? > @dialog.show > else > @dialog.bring_to_front > end > end > > end >Very good. I know not for me but thanks
Chris
Advertisement