|
TProgressBar isn't intrinsically confusing - it's the presence of an apparent
two ways to accomplish the same thing which is confusing. Specifically, the
presence of the Step property and the StepIt method as opposed to the Position
property.
Here is an example of the way to use TProgressBar and always end up with a
progress bar that properly tracks your loop.
myProgressBar->Max = NumberOfExpectedLoopInterations;
for (int Index = 0; Index < NumberOfExpectedLoopIterations; Index++)
{
// Do whatever the loop does, then...
myProgressBar->Position = myProgressBar->Position
+ 1;
}; |
Make your life easier - pretend that Step and StepIt don't exist.
And don't forget, your loop may require an Application->ProcessMessages();
to ensure that the ProgressBar can repaint as it changes.
|