[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [platform-swt-dev] SWT Event Processing
|
Yes, I'm using Display.asyncExec but
wanted to try to keep all the display code together. So, I'm currently
doing the following in my monitor thread:
// send the
sensor reading info to the display shell if it exists
if
(m_Shell != null)
{
m_Shell.getDisplay().asyncExec(new Runnable()
{
public void run()
{
Event e = new
Event();
e.data =
""> m_Shell.notifyListeners(SWT.Modify,e);}
});
}
and
then have a subscribing listener in the main thread. I randomly picked
SWT.Modify because I couldn't find something used for generic event
communications.
Are all event types mainly used by internal event
processors? It would be nice if we could define our own or have on
reserved for application use.
Events provided a nice container for the
data to be passed to the UI thread, and I assume the reference in the event
keeps the object active until it is consumed, even when it goes out of scope in
the "posting" thread.
I'd been to the snippets and found many useful
topics covered... just nothing on the event pump and
generation.
while (!shell.isDisposed())
{
if
(!display.readAndDispatch())
display.sleep();
}
Thanks again,
Nat
Friday, September 12, 2003 3:30 PM
To:
platform-swt-dev@xxxxxxxxxxx
cc: platform-swt-dev@xxxxxxxxxxx,
platform-swt-dev-admin@xxxxxxxxxxx
From: Steve Northover
<Steve_Northover@xxxxxxxxxx>
Subject: Re: [platform-swt-dev] SWT Event
Processing
It sounds to me
like you want to get away from events all together and use Display.syncExec() or
Display.asyncExec() to communicate between threads. Check
www.eclipse.org/swt for snippets etc.