Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003720 [JEDI VCL] 00 JVCL Components major always 2006-05-22 10:45 2006-06-09 04:07
Reporter ain View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version 3.00
Summary 0003720: JvXPProgressBar doesnt work as expected
Description When executing code like

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

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
JvXPProgressBar1.StepIt;

then the bar shows 100% way before the completion of the loop.
Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0009340)
jac2 (reporter)
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;
var
  ASize: Integer;
begin
  if (Max - Min <= 0) or (Width <= 0) or (Height <= 0) then
    Exit;
  // 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);
end;

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

JAC.
(0009345)
ain (reporter)
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;
begin
  for x:= JvXPProgressBar2.Min to JvXPProgressBar2.Max do begin
     JvXPProgressBar2.StepIt;
     JvXPProgressBar2.Refresh;
     Sleep(60);
  end;
  ShowMessage('Done');
end;

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%
(0009530)
obones (administrator)
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.

- Issue History
Date Modified Username Field Change
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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker