Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » multiple top-level shells
multiple top-level shells [message #441747] Mon, 23 August 2004 14:29 Go to next message
Paul Singleton is currently offline Paul SingletonFriend
Messages: 37
Registered: July 2009
Member
If an SWT app has more than one top-level shell, is this
OK for the event dispatching loop?

while (display.getShells().length > 0) {
if (!display.readAndDispatch ()) {
display.sleep ();
}
}

The Javadoc says that Display#getShells() returns only
*undisposed* shells (unlike, say, Composite#getChildren)

Paul Singleton
Re: multiple top-level shells [message #442144 is a reply to message #441747] Fri, 27 August 2004 15:51 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
The problem you could run into is that display is disposed causing
display.getShells() to throw an exception.

The following is better:

while (!display.isDisposed() && display.getShells().length > 0) {
if (!display.readAndDispatch ()) {
display.sleep ();
}
}


"Paul Singleton" <paul@jbgb.com> wrote in message
news:cgcure$eot$1@eclipse.org...
> If an SWT app has more than one top-level shell, is this
> OK for the event dispatching loop?
>
> while (display.getShells().length > 0) {
> if (!display.readAndDispatch ()) {
> display.sleep ();
> }
> }
>
> The Javadoc says that Display#getShells() returns only
> *undisposed* shells (unlike, say, Composite#getChildren)
>
> Paul Singleton
>
Re: multiple top-level shells [message #442530 is a reply to message #441747] Tue, 07 September 2004 15:13 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
This will work however, do you really want to compute the list of shells
between every operating system event? A better solution would be to keep
the shell count yourself.
"Paul Singleton" <paul@jbgb.com> wrote in message
news:cgcure$eot$1@eclipse.org...
> If an SWT app has more than one top-level shell, is this
> OK for the event dispatching loop?
>
> while (display.getShells().length > 0) {
> if (!display.readAndDispatch ()) {
> display.sleep ();
> }
> }
>
> The Javadoc says that Display#getShells() returns only
> *undisposed* shells (unlike, say, Composite#getChildren)
>
> Paul Singleton
>
Previous Topic:Image Button on Pocket PC
Next Topic:Memory leaks
Goto Forum:
  


Current Time: Thu Sep 19 14:46:11 GMT 2024

Powered by FUDForum. Page generated in 0.03667 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top