mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-22 22:09:43 +01:00
listview: fixes for improper OwnerDataListItem.Owner. #18961
git-svn-id: trunk@30832 -
This commit is contained in:
parent
90fa711a3a
commit
a32a3ef4ca
@ -786,6 +786,7 @@ type
|
|||||||
procedure DoCacheItem;
|
procedure DoCacheItem;
|
||||||
public
|
public
|
||||||
procedure SetDataIndex(ADataIndex: Integer);
|
procedure SetDataIndex(ADataIndex: Integer);
|
||||||
|
procedure SetOwner(AOwner: TListItems);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TListItemsEnumerator }
|
{ TListItemsEnumerator }
|
||||||
|
|||||||
@ -1045,16 +1045,18 @@ procedure TCustomListView.SetOwnerData(const AValue: Boolean);
|
|||||||
begin
|
begin
|
||||||
if FOwnerData=AValue then exit;
|
if FOwnerData=AValue then exit;
|
||||||
FOwnerData:=AValue;
|
FOwnerData:=AValue;
|
||||||
|
FOwnerDataItem.SetOwner(nil);
|
||||||
Items.Free;
|
Items.Free;
|
||||||
if AValue then
|
if AValue then
|
||||||
begin
|
begin
|
||||||
FSelectedIdx:=-1;
|
FSelectedIdx:=-1;
|
||||||
Items:=TOwnerDataListItems.Create(Self);
|
FListItems:=TOwnerDataListItems.Create(Self);
|
||||||
end else
|
end else
|
||||||
Items:=TListItems.Create(Self);
|
FListItems:=TListItems.Create(Self);
|
||||||
|
|
||||||
if HandleAllocated then
|
if HandleAllocated then
|
||||||
TWSCustomListViewClass(WidgetSetClass).SetOwnerData(Self, AValue);
|
TWSCustomListViewClass(WidgetSetClass).SetOwnerData(Self, AValue);
|
||||||
|
FOwnerDataItem.SetOwner(FListItems);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomListView.SetProperty(const ALvpOrd: Integer;
|
procedure TCustomListView.SetProperty(const ALvpOrd: Integer;
|
||||||
|
|||||||
@ -809,6 +809,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TOwnerDataListItem.SetOwner(AOwner: TListItems);
|
||||||
|
begin
|
||||||
|
FOwner:=AOwner;
|
||||||
|
FFlags := [];
|
||||||
|
FStates := [];
|
||||||
|
FImageIndex := -1;
|
||||||
|
FreeAndNil(FSubItems);
|
||||||
|
end;
|
||||||
|
|
||||||
function TOwnerDataListItem.GetSubItems: TStrings;
|
function TOwnerDataListItem.GetSubItems: TStrings;
|
||||||
begin
|
begin
|
||||||
if not FCached then DoCacheItem;
|
if not FCached then DoCacheItem;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user