0

Where can I place my code which would execute each draw cycle?
Example: Let's say you want a timer, or a clock.

Then basically you have your Window, and a label.
The label shows the time, but you need to refresh it.
How do you do it?

Another example: You need to re-check if a server got new data, if it does, refresh your data, and then re-draw your Table.

Apache
  • 1,060
  • 5
  • 21
  • 38

1 Answers1

0

You just call the appropriate method to update the control. For a label that would be setText for a TableViewer you would use update or refresh.

What you must do is execute the UI updates in the user interface thread. If your code is called from a timer or something like that it may not be in the UI thread. In this case use Display.asyncExec to run the update code.

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • Thanks. I'll give it a try as soon as I get to my project. (Will accept answer if it works ofc.) – Apache Nov 26 '13 at 17:09