[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: About widgetSelected

Lazytiger wrote:
Hello everyone,
I have a problem when I want to update a label in a widgetSelected method, what I found is this update only take effect after this method invoked. But I want to do serveral thing in this method and the label shows the status as a status bar.

Use Control.update() to force repaint the control.

And I also can't use UI component in a thread, How can I hanle these things?
Thanks very much!




Use Display.syncExec(Runnable) or Display.asyncExec(Runnable) and put the code to update your widgets in the Runnable. The syncExec method returns after the Runnable has completely run, whereas the asyncExec just puts the runnable on the event queue and returns immediately. Unless there are specific timing issues, asyncExec is probably your best choice.


Matthew