Andreschrosa Posted November 26, 2008 Share Posted November 26, 2008 I would like to have a progress bar show the progress of the network scan in my application, is it possible to update a progress bar from within a sequence? I've tried and so far it updates to full when the sequence ends. Link to comment Share on other sites More sharing options...
AzeoTech Posted November 26, 2008 Share Posted November 26, 2008 Yes, just set the progress bar to display a global variable, then update that global from within the sequence. Make sure the range on the progress bar is appropriate. The thing is, if your sequence is running at full bore, doesn't have any delay()'s in it, and is at priority 2 or higher, then you are not letting the DAQFactory user interface update itself. This is why you see it update only at the end of the sequence. Try putting a small delay, even delay(0.01) inside your loop. Link to comment Share on other sites More sharing options...
Andreschrosa Posted November 26, 2008 Author Share Posted November 26, 2008 I tested what you suggested, I noticed another thing: it works if I run the sequence opening it and typing F5, however I was running it from a button click using quick sequence... changed it to start/stop sequence and it worked! Link to comment Share on other sites More sharing options...
AzeoTech Posted November 26, 2008 Share Posted November 26, 2008 Yes, that is because when you call a sequence as a function, i.e.: sequencename() instead of using beginseq(sequencename) you are running the script in the thread of the calling script. The action of a button runs in the main thread of the application which handles the user interface. Since the thread is tied up doing your script it can't do anything else with the user interface. You should never put script that takes a long time inside (or called from) the action of a screen control. You should always put it in a sequence and then start that sequence using beginseq() to run it in a background thread. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.