t j
t j

Reputation: 413

Firemonkey TListview Behavour

When using a TListview in Delphi, if you click below the last list item the selected item becomes nil (itemindex = -1).

When using a TListview in Firemonkey, if you click below the last list item the selected item is the last item on the list. That is not what I want to happen. If I click below the last item, I want no item to be selected.

I am at a loss. Is there a way to do this or have I missed something here or am I off-base?

Thanks.

Upvotes: 1

Views: 700

Answers (1)

nonpa10
nonpa10

Reputation: 11

The problem is at FMX.ListView.pas unit at FindItemAbsoluteAt procedure, line 4060.

This code:

if ViewAt >= HeightSums[HeightSums.Count - 1] then
Exit(HeightSums.Count - 1);

Replace with this code:

if ViewAt >= HeightSums[HeightSums.Count - 1]+GetItemHeight(HeightSums.Count-1) then
Exit(-1);

And the system will start to work logically.

Source: https://pjstrnad.com/another-fix-delphi-code-click-listview/

Upvotes: 1

Related Questions