Recent

Author Topic: Implementing a filter for a ListBox  (Read 1093 times)

fedkad

  • Full Member
  • ***
  • Posts: 176
Implementing a filter for a ListBox
« on: September 23, 2018, 01:22:39 pm »
I am trying to implement a filter to an application that manages a list of memo contents.

I am trying to use the TListFilterEdit LazControl. However, since the ListBox that lists the memos (actually the memos’ first or “index” lines) is also holding the whole memos (all the lines of each memo) in its Items.Objects, the TListFilterEdit destroys these contents when some memos are filtered out.

To solve this problem, I tried to move all the contents of Items.Objects in the Listbox to a new object (FList:TStringList;) and try to manage both the FList and the ListBox in parallel.

A test program is attached.

I would appreciate very much if you comment on this approach. Especially on the efficiency of the code, since this code may handle thousands of memos each one containing megabytes of text.

Thanks.
Lazarus 2.2.6 / FPC 3.2.2 on x86_64-linux-gtk2 (Ubuntu/GNOME) and x86_64-win64-win32/win64 (Windows 11)

 

TinyPortal © 2005-2018