Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Question on asyncexec and updating UI Elements
Question on asyncexec and updating UI Elements [message #516422] Tue, 23 February 2010 15:54 Go to next message
Eclipse UserFriend
I am trying to update a progressbar during a loop of processing.

new Thread()
{
public void run()
{
//some processing code here in a loop
progval++; //this is actually in the loop

try { Thread.sleep(100); } catch {}
if (display.isDisposed()) return;
display.getDefault().asyncExec(new Runnable() {
public void run()
{
progressBar.setSelection(progval);
}
});
}
}.start();


The problem is that progval, inside the Runnable, isn't recognized. How
do I get a value that is outside of the Runnable to be recognized and
usable inside? Is there a way to pass a value into it?
Re: Question on asyncexec and updating UI Elements [message #516456 is a reply to message #516422] Tue, 23 February 2010 23:39 Go to previous message
Eclipse UserFriend
FIrst of all why are you not using Jobs API...

Secound...

The question is too generic...
there can be many answers....
1.make progval class level variable..
2.Create a class which impeiments runnable and create a constructor which gets the "progVal".

etc
Previous Topic:How to update the width of a label when its value change
Next Topic:Custom Cocoa widget with SWT OSX Coca
Goto Forum:
  


Current Time: Fri Jul 04 20:09:34 EDT 2025

Powered by FUDForum. Page generated in 0.03437 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top