Hi,
Attached is a patch for TListItem, adding the property ListView, so you
can reference the listview associated with the list item.
This was inconsistent with Delphi's TListItem.
Regards,
- Graeme -
Index: comctrls.pp
===================================================================
--- comctrls.pp (revision 8389)
+++ comctrls.pp (working copy)
@@ -565,6 +565,8 @@
TListItemFlag = (lifDestroying, lifCreated);
TListItemFlags = set of TListItemFlag;
+ { TListItem }
+
TListItem = class(TPersistent)
private
FOwner: TListItems;
@@ -574,6 +576,7 @@
FData: Pointer;
FImageIndex: Integer;
FStates: TListItemStates;
+ function GetListView: TCustomListView;
function GetState(const ALisOrd: Integer): Boolean;
function GetIndex: Integer;
function GetSubItemImages(const AIndex: Integer): Integer;
@@ -606,6 +609,7 @@
property Focused: Boolean index Ord(lisFocused) read GetState write
SetState;
property Index: Integer read GetIndex;
property ImageIndex: Integer read FImageIndex write SetImageIndex default
-1;
+ property ListView: TCustomListView read GetListView;
property Owner: TListItems read FOwner;
property Selected: Boolean index Ord(lisSelected) read GetState write
SetState;
property SubItems: TStrings read GetSubItems write SetSubItems;
Index: include/listitem.inc
===================================================================
--- include/listitem.inc (revision 8389)
+++ include/listitem.inc (working copy)
@@ -443,6 +443,14 @@
end;
{------------------------------------------------------------------------------}
+{ The ListView this ListItem belongs to
}
+{------------------------------------------------------------------------------}
+function TListItem.GetListView: TCustomListView;
+begin
+ Result := Owner.Owner;
+end;
+
+{------------------------------------------------------------------------------}
{ TListItem GetSubItemImages
}
{------------------------------------------------------------------------------}
function TListItem.GetSubItemImages(const AIndex: Integer): Integer;