Hi

Actually multi threading is not a matter of Qooxdoo. It's a matter of 
JavaScript. Indeed the only way to parallelise procedures is web worker. 

But in your case you should rethinking your code. As I could see in a quick 
overview you are calling many timeouts at the same time. That means after 2 
seconds all of your timeout functions will be called. So just last one will 
have a visible effect. 

I guess it's better to start one short time out which will update the view and 
call the same function again in a timeout till a condition is guilty. 

If you desire to use a Qooxdoo method to initialise an interval take a look on 
qx.event.Timer

Hope I could help

Regards Mustafa 

Von meinem iPhone gesendet

Am 03.08.2012 um 20:24 schrieb "Eric Paul" <ericallenp...@hotmail.com>:

> Is there a way to display a progress bar while performing a long running
> task?
> 
> Generally when I do this it requires 2 threads, does such a thing exist in
> qooxdoo?
> 
> Here's what I have so far:
> 
> //console.clear();
> 
> // Document is the application root
> var root = this.getRoot();      
> var box = new qx.ui.layout.VBox();      
> var container = new qx.ui.container.Composite(box);
> 
> var pb = new qx.ui.indicator.ProgressBar(0, 100);    
> var lblPrimary = new qx.ui.basic.Label();
> var lblSecondary = new qx.ui.basic.Label();
> var totalCount = 1000;
> 
> // Create a button
> var button1 = new qx.ui.form.Button("GO",
> "icon/22/apps/internet-web-browser.png");
> button1.setMaxWidth(100);
> 
> root.add(container, {left:0,top:0});   
> container.add(lblPrimary);
> container.add(pb);        
> container.add(lblSecondary);
> container.add(button1);
> 
> lblPrimary.setValue("Please Wait...");
> lblSecondary.setValue("Completed: 0 (0%)");
> 
> box.setSpacing(10);      
> container.setPadding(20);
> 
> //get real time change from the progressbar
> pb.addListener("change", function(e) {        
>  lblSecondary.setValue("Completed: " + pb.getValue() + " (" + e.getData() +
> "%)");        
>  lblSecondary.setTextColor("black");      
> });
> 
> 
> // Add an event listener
> button1.addListener("execute", function(e) {
> 
>  for(i = 0; i<totalCount; i++)
>  {
>    setTimeout(function () { 
> 
>      var percentComplete = i / totalCount * 100;  
>      pb.setValue(percentComplete);
>      lblSecondary.setValue("Completed: " + i + " (" + percentComplete +
> "%)");
> 
>    }, 2000); 
> 
>  }
> 
> });
> 
> //when complete make the info text green
> pb.addListener("complete", function(e) {        
>  lblSecondary.setTextColor("green");      
> });
> 
> 
> Everything works as advertised, but I really want my for loop to update the
> progress bar and labels as it is performing the work.
> 
> Thanks,
> 
> -Eric
> 
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to