Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 20:54 Go to next message
MP Mising name is currently offline MP Mising nameFriend
Messages: 18
Registered: July 2009
Junior Member
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] Wed, 24 February 2010 04:39 Go to previous message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
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


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
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: Sat Dec 07 18:23:05 GMT 2024

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

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

Back to the top