* Fixed bug on ListItems.Delete

git-svn-id: trunk@1542 -
This commit is contained in:
lazarus 2002-03-24 16:38:01 +00:00
parent 08109d2171
commit 790daedb9c
3 changed files with 28 additions and 6 deletions

View File

@ -420,7 +420,8 @@ type
private
FOwner : TCustomListView;
FItems : TList;
Function GetCount : Integer;
function GetCount : Integer;
procedure ItemDeleted(const AItem: TListItem); //called by TListItem when freed
protected
function GetItem(const AIndex: Integer): TListItem;
procedure SetITem(const AIndex: Integer; const AValue: TListItem);
@ -1782,6 +1783,10 @@ end.
{ =============================================================================
$Log$
Revision 1.29 2002/03/24 16:38:00 lazarus
MWE:
* Fixed bug on ListItems.Delete
Revision 1.28 2002/03/23 15:51:17 lazarus
MWE: Fixed more compatebility issues (Sort, SelectedItem)

View File

@ -72,7 +72,7 @@ destructor TListItem.Destroy;
begin
FDestroying := True;
if FOwner <> nil
then FOwner.Delete(Index);
then FOwner.ItemDeleted(Self);
SubItems.Free;
inherited Destroy;
@ -90,6 +90,10 @@ end;
{ =============================================================================
$Log$
Revision 1.8 2002/03/24 16:38:01 lazarus
MWE:
* Fixed bug on ListItems.Delete
Revision 1.7 2002/03/23 15:49:22 lazarus
MWE: Fixed more compatebility issues (Sort, SelectedItem)

View File

@ -54,10 +54,19 @@ end;
{------------------------------------------------------------------------------}
procedure TListItems.Delete(const AIndex: Integer);
begin
if (FItems.Items[Aindex] <> nil)
then Item[AIndex].Delete;
FItems.Delete(AIndex);
FOwner.ItemDeleted(AIndex);
Item[AIndex].Delete;
end;
{------------------------------------------------------------------------------}
{ TListItems ItemDeleted }
{------------------------------------------------------------------------------}
procedure TListItems.ItemDeleted(const AItem: TListItem);
var
idx: Integer;
begin
idx := FItems.Remove(AItem);
if (idx >= 0) and (FOwner <> nil)
then FOwner.ItemDeleted(idx);
end;
{------------------------------------------------------------------------------}
@ -111,6 +120,10 @@ end;
{ =============================================================================
$Log$
Revision 1.10 2002/03/24 16:38:01 lazarus
MWE:
* Fixed bug on ListItems.Delete
Revision 1.9 2002/03/23 15:49:22 lazarus
MWE: Fixed more compatebility issues (Sort, SelectedItem)