A better listview ?
From: Skybuck Flying (nospam_at_hotmail.com)
Date: 02/23/04
- Next message: Skybuck Flying: "Re: A better listview ?"
- Previous message: Skybuck Flying: "Stupid ListView.FindData"
- Next in thread: Skybuck Flying: "Re: A better listview ?"
- Reply: Skybuck Flying: "Re: A better listview ?"
- Reply: Skybuck Flying: "The problem simplified."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 23 Feb 2004 15:24:47 +0100
Hi
I need a better listview for finding items...
Custom's ListView FindData is a bit stupid... it only compares pointers..
It could for example compare strings...
Since I am not really a component person... I wonder how much work it is to
create a new TmyListview
put it on the component palette and override the finddata...
Is that possible without to much hassle ?!
function TCustomListView.FindData(StartIndex: Integer; Value: Pointer;
Inclusive, Wrap: Boolean): TListItem;
var
I: Integer;
Item: TListItem;
begin
Result := nil;
if Inclusive then Dec(StartIndex);
for I := StartIndex + 1 to Items.Count - 1 do
begin
Item := Items[I];
if (Item <> nil) and (Item.Data = Value) then
begin
Result := Item;
Exit;
end;
end;
if Wrap then
begin
if Inclusive then Inc(StartIndex);
for I := 0 to StartIndex - 1 do
begin
Item := Items[I];
if (Item <> nil) and (Item.Data = Value) then
begin
Result := Item;
Exit;
end;
end;
end;
end;
Bye,
Skybuck.
- Next message: Skybuck Flying: "Re: A better listview ?"
- Previous message: Skybuck Flying: "Stupid ListView.FindData"
- Next in thread: Skybuck Flying: "Re: A better listview ?"
- Reply: Skybuck Flying: "Re: A better listview ?"
- Reply: Skybuck Flying: "The problem simplified."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]