Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-swt-dev] Howto change text across threads

There are a number of ways to do this. I usually use a event
notification to the thread that owns the control. I use a thread safe
queue, I put the incomming event notification onto the queue in the
thread that wishes to notify the owner thread. And then in the loop of
the owner thread I check the queue for any outstanding notifications and
update the text based on what's in the event.

This is just one way, there are quite a few depending on your needs.

Check these out:

http://java.sun.com/docs/books/tutorial/essential/threads/
http://java.sun.com/docs/books/tutorial/uiswing/events/
http://java.sun.com/docs/books/tutorial/essential/threads/waitAndNotify.
html

-----Original Message-----
From: platform-swt-dev-admin@xxxxxxxxxxx
[mailto:platform-swt-dev-admin@xxxxxxxxxxx]On Behalf Of Hans Lassen -
Arsmatrix.com
Sent: Wednesday, April 07, 2004 8:43 AM
To: platform-swt-dev@xxxxxxxxxxx
Subject: [platform-swt-dev] Howto change text across threads


Hi,

How do I change the contents of a Text-field from another Thread.

I have a Text field which all threads should log their states to, but I 
keep getting error messages saying that I'm not allowed to change the 
contents across Threads.

What is the proper way to do this?

/Hans

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


Back to the top