Community
Participate
Working Groups
Build Identifier: SWT 3.5.2 running outside Eclipse Dear All: I am using: swt-3.5.2-gtk-linux-x86_64.jar (Firefox 3.0) swt-3.5.2-win32-win32-x86.jar (IE 7? on Windows XP 64-bit) On both, I am unable to get any events with VisibilityWindowListener. For example, the example found here: http://www.java2s.com/Tutorial/Java/0280__SWT/AddingVisibilityWindowListener.htm never calls the visibility listeners. I have gotten around this by using the SWT.Show and SWT.Hide listeners for the parent shell as shown in following code snippet. Please correct me if I am missing something simple, but it seems per instructions I _should_ get notified or visibility changes (e.g., shell.open()) and I do _not_. Thank you Misha --- browser.addVisibilityWindowListener(new VisibilityWindowListener() { public void hide(WindowEvent event) { debug("VisibilityWindowListener.hide: "+event); setVisible(false); synchronized(driver) { driver.notifyAll(); } } public void show(WindowEvent event) { debug("VisibilityWindowListener.show: "+event); setVisible(true); synchronized(driver) { driver.notifyAll(); } } }); browser.getShell().addListener(SWT.Hide,new Listener() { public void handleEvent(Event event) { debug("SWT.Hide,Listener.handleEvent: "+event); setVisible(false); synchronized(driver) { driver.notifyAll(); } } }); browser.getShell().addListener(SWT.Show,new Listener() { public void handleEvent(Event event) { debug("SWT.Show,Listener.handleEvent: "+event); setVisible(true); synchronized(driver) { driver.notifyAll(); } } }); Reproducible: Always
These listeners are invoked when an action in an existing Browser causes a second Browser to be opened. The correct use of these listeners is demonstrated in http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet173.java . To see them in action run the linked snippet and point it at a file with the following content: <html> <script type="text/javascript"> setTimeout("window.open('http://www.eclipse.org', '', 'menubar=1,width=600, height=600');", 3000); </script> <body> This test uses javascript to open a new window after 3 seconds. </body> </html> Closing as WORKSFORME. If the case above fails for you then please follow up here.