Project JEDI - Issue Tracker - JEDI VCL
Viewing Issue Advanced Details
3720 00 JVCL Components major always 2006-05-22 10:45 2006-06-09 04:07
resolved 3.00  
none 3.30  
0003720: JvXPProgressBar doesnt work as expected
When executing code like

  JvXPProgressBar1.Max:= 10;
  for x:= JvXPProgressBar1.Min to JvXPProgressBar1.Max do

then in the end of the loop progrss bar is about 2/3 filled. I expect
it to be 100%. Or when executing

  JvXPProgressBar1.Max:= 1000;
  for x:= JvXPProgressBar1.Min to JvXPProgressBar1.Max do

then the bar shows 100% way before the completion of the loop.
Issue History
2006-05-22 10:45 ain New Issue
2006-05-23 04:38 jac2 Note Added: 0009340
2006-05-23 13:18 ain Note Added: 0009345
2006-06-09 04:06 obones Status new => resolved
2006-06-09 04:06 obones Resolution open => fixed
2006-06-09 04:06 obones Assigned To => obones
2006-06-09 04:06 obones Note Added: 0009530

2006-05-23 04:38   
Looking at the code TJvCustomXPProgressBar.DrawBar, seems to be issues around the building of the blocks and integer maths, it works in whole pixels, so you can get n pixels under or over on every block, instead using real numbers or division to decide where to draw the blocks.

Not a problem with StepIt per se.

I have tested (just for this case) and it works much better
procedure TJvBaseProgressBar.Paint;
  ASize: Integer;
  if (Max - Min <= 0) or (Width <= 0) or (Height <= 0) then
  // calculate the size of the bar based on Min, Max, Position and Width or Height
  ASize := MulDiv(GetMaxBarSize, (Position - Min), (Max - Min));
  if not Smooth then
    ASize := (ASize div steps) * steps;
  DrawBar(Canvas, ASize);

Before there was a line:
    APos := APos - APos mod Steps;
which I can not see doing the job.

2006-05-23 13:18   
Hmm, in my quick test it doesn't make a difference... just drop JvXPPrpgress bar onto form and:

procedure TForm1.Button1Click(Sender: TObject);
var x: Integer;
  for x:= JvXPProgressBar2.Min to JvXPProgressBar2.Max do begin

I see the progrssbar to show 100% way before message box pops up.
If I include

  JvXPProgressBar2.Steps:= 1;

in front of the loop, progress bar stays at 0%
2006-06-09 04:06   
This is now solved in SVN.
Note that setting stepping above the max value (when Steps is greater than 1 for instance) will stay at the max value as soon as it reached it. It is the same behaviour that is displayed by TJvGradientProgressBar.