Jump to content
Sign in to follow this  
JimKueneman

Listview Items during Search

Recommended Posts

When I access TListview.Items when the search bar contains a string the property is only returning items that are presented in the LV during that time.  I have data stored in the ObjectTag that is being updating in the background so when it comes in I need store it in these object but during a search I can't access them through TListview.Items  

I am not seeing a property that give me access to the unfiltered list of items stored in the list view.  How to I access a  full list of TListview Items while the control is in search mode?

 

Thanks,

JIm

Share this post


Link to post

hi @JimKueneman

 

you can try this way:

implementation

{$R *.fmx}

uses
  System.Generics.Collections;

procedure TForm1.FormCreate(Sender: TObject);
var
  LVI: TListViewItem;
begin
  for var i: integer := 0 to 30 do // for tests...
    begin
      LVI      := ListView1.Items.Add;
      LVI.Text := 'Item' + i.ToString;
    end;
end;

procedure TForm1.ListView1SearchChange(Sender: TObject);
var
  LText: string;
begin
  for var i in ListView1.Items.UnfilteredItems do
    if i is TListViewItem then
      LText := LText + TListViewItem(i).Text + slinebreak;
  //
  Memo1.Text := LText;
end;

 

image.thumb.png.ebdb703850416166c743a6018d2253f6.png

 

Edited by programmerdelphi2k
  • Like 1
  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×