Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] SWT multiple dialogs

You should use the same display for all of your dialogs.  Note that there 
is a Shell constructor which does not require that you pass in a display 
and it will manage the creation of the Display for you.

Ideally, your application should create the display once and make it 
available to your shells.  Alternately you can find out what the display 
for the current thread is using:

Display display = Display.getCurrent();
if (display == null) display = new Display();

This assumes you are creating all of your dialogs in the same thread.  You 
should only have one Display object and you should run all your SWT code 
in the thread in which you created the Display.  If you are doing work in 
another thread and need to access the widgets, you can use 
Display.syncExec or Display.asyncExec.

See:
http://www.eclipse.org/documentation/pdf/org.eclipse.platform.doc.isv.pdf
Go to Standard Widget Toolkiit -> Threading issues for clients.





Maika Können <maika.koennen@xxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
02/14/2003 09:08 AM
Please respond to platform-swt-dev

 
        To:     platform-swt-dev@xxxxxxxxxxx
        cc: 
        Subject:        [platform-swt-dev] SWT multiple dialogs


Hi all!

I'm a newbie in SWT. My application (it is a GUI) should do the following:
I create a main dialog with a menu bar. When the user click on a special 
menu item, a new second dialog should appear. The main dialog must be 
open. I write an abstract class for the dialogs, because they look each 
time the same: a menu bar, a tool bar, a sash form and a label. So I also 
create the display-object and the shell-object in this abstract class. All 
classes which should create a dialog succeeded from this abstract class. 
When I now make a new object from the the second dialog, I get an 
exception: Invalid thread access. How should I do the creation of multiple 
dialogs? Can anyone help me or know who I can get help of SWT? A snippet 
of code would help me very much. 
Is there a book which deal with the theme SWT?
Many thanks for the help!
Kind regard
Maika
______________________________________________________________________________
Mit der Multi-SMS von WEB.DE FreeMail koennen Sie 760 Zeichen versenden.
Informationen unter http://freemail.web.de/features/?mc=021184

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev





Back to the top