View Issue Details

IDProjectCategoryView StatusLast Update
0003720JEDI VCL00 JVCL Componentspublic2006-06-09 04:07
ReporterainAssigned Toobones 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.30 
Summary0003720: JvXPProgressBar doesnt work as expected
DescriptionWhen 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.
TagsNo tags attached.

Activities

jac2

2006-05-23 04:38

reporter   ~0009340

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.

ain

2006-05-23 13:18

reporter   ~0009345

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%

obones

2006-06-09 04:06

administrator   ~0009530

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