Incremental search not working in virtual ListView
- Lazarus/FPC Version: Lazarus 2.3.0 (rev main-2_3-1245-gb59e6c722c) FPC 3.2.2 i386-win32-win32/win64, but any older version affected as well
- Operating System: Windows (Win 11 tested)
- CPU / Bitness: 32 or 64
What happens
Windows has the built-in behaviour that text typed when a ListView is focused is used for an incremental search. The first list item with a matching caption (beginning with the typed text) is selected. This works in normal mode (i.e when the list items are stored inside the ListView), but is does not work in virtual mode where the selected item is not changed (after commit d3396e9f), or always jumps to the first item (before commit d3396e9f).
In Delphi, the incremental search works in both normal and virtual modes.
What did you expect
Same behaviour between normal and virtual mode, i.e. when text is typed into the ListView the selection should jump to that item which has a caption beginning with the typed text.
Steps to reproduce
Run attached demo:
39748_virtual_listview_incremental_search.zip
- Focus the right listview, it is operated in normal mode. Select the last item ('aac'), type the text 'abc' (do not wait too long between the characters otherwise Windows will erase the search buffer), the selection will jump to the corresponding list item.
- Repeat the same with the left ListView which is operated in virtual mode: If your Lazarus version contains commit d3396e9f, the selection will not move; otherwise it will jump to the first item.