Prog_Bar Frequently Asked Questions
Answers
What is the best way to use Prog_bar?
As a progress bar is intended for use when the main program is performing some large task, it makes sense that the bar itself should not interfere with the main task. For this reason it is best to update the bar only as often as necessary to maintain a smooth expansion. These updates should be spread as evenly as possible throughout the duration of the main task.
You need to work out how often the bar's imagery will change. This figure is calculated as MAX (number of pixels, max value of counter) + 1 (the extra 1 is to allow for the completely empty bar). If you are not using the text display this formula can be simplified to number of pixels + 1
The number of pixels will be the overall width of the bar (or height, if it grows vertically), minus the number of pixels used for the border. A ridge border uses 8 pixels horizontally and 4 vertically, while a plain, recessed or raised border uses 4 horizontally and 2 vertically.
The maximum value of the counter will be either 100 (percentage counter) or the logical size of the bar.
For example, a horizontal bar which is 250 pixels long using a percentage display and a ridge border will need at least 243 ((250 - 8) + 1) updates for a smooth motion. However, if this bar was only 50 pixels wide it would still need at least 101 updates for the counter to operate smoothly.
Note that this is intended only as a guideline. Updating the bar less often will result in a jumpy motion, while more often will just slow down the main program with no visual improvement. However, getting as close to this figure as possible will result in the best overall performance.