View Issue Details

IDProjectCategoryView StatusLast Update
0003110JEDI VCL00 JVCL Componentspublic2005-08-16 08:16
ReporteranonymousAssigned Toobones 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.10 
Summary0003110: TJvgAskListBox Lose the Items.Objects Value
DescriptionFor the first time, when you add items to the TJvgAskListBox and assigns an Object for the item, you loose the object for the first items if you add more items than the heoght of the TJvgAskListBox, when its scroll its lose the firsts objects.
The problems seems to be in:

procedure TJvgAskListBox.RecalcHeights;
var
  I: Integer;
  R: TRect;
begin
  if Items.Count = 0 then
    Exit;

  SendMessage(Handle, LB_GETITEMRECT, Items.Count - 1, LPARAM(@R));
  FSegment1Width := Word((R.Right - R.Left) - (FButtonWidth + 1) *
    (Buttons.Count) - 1);

//The problem its here
{ Items.BeginUpdate;
  for I := 0 to Items.Count - 1 do
  begin
    Items.Insert(I, Items.Strings[I]);
    Items.Delete(I + 1);
  end;
  Items.EndUpdate;}
end;

I have comented the ItemsUpdate and its seems to work fine.
Additional InformationIt is the code I have used to test it:

procedure TForm1.Button1Click(Sender: TObject);
var i: integer;
begin
  Asklist.Items.Clear;
  for i:= 0 to maxi do
  begin
    AskList.Items.Objects[Asklist.Items.Add(IntToStr(i))] := TObject(i);
  end;
end;

procedure TForm1.AskListClick(Sender: TObject);
var i: integer;
begin
  for i:= 0 to maxi do
  begin
    Label1.Caption := IntToStr(i) + ':' + IntToStr(Integer(Asklist.Items.Objects[i]));
    Label1.Update;
    Sleep(100);
  end;
end;
TagsNo tags attached.

Activities

obones

2005-08-16 08:16

administrator   ~0007802

This is now solved in CVS, using InsertObject instead of Insert.

Issue History

Date Modified Username Field Change
2005-07-24 04:31 anonymous New Issue
2005-08-16 08:16 obones Status new => resolved
2005-08-16 08:16 obones Resolution open => fixed
2005-08-16 08:16 obones Assigned To => obones
2005-08-16 08:16 obones Note Added: 0007802