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
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