Adding a progress bar to the panel

Hi, 

I am trying to add a progress bar to my program panel. The way I was trying to work it out was to insert a global variable in a for loop in my program and tie the variable to the progress bar. This didn't really work in a smooth manner. I am wondering whether there is a systematic well established way to add progress bars to panels. 

Kindly advise. 

Sincerely, 

Peeyush

If your "progress" is not linked to a calculation or execution within Igor (e.g., you want to count time or number of external inputs) then you may also want to look into background functions which check for updates on something periodically. I use this approach for device control code.

DisplayHelpTopic "Background Tasks"

 

Thanks a lot johnweeks and chozo, I'll go through these help topics. 

Quick update. Here is something I tried: 

NVAR progval  //this variable is tied to the progress bar

for(i=0;i<count:i+=1)    //count being total iterations in a for loop in some program for which I need the progress bar

progval=(i/count)*100

DoUpdate/W=Panelname

endfor

 

This appeared to work but the program execution slowed down a lot. While the loop ran in 2 seconds earlier without the DoUpdate, now I had to wait for 40 seconds for it to execute. 

Is there a way to make the loop execution faster while doing DoUpdates? 

Drawing is slow. If you can document some sort of bug (multiple draws during a single DoUpdate, for instance) that would be something we want to know about.