Hi Experts, I'm trying to detect what item is double-clicked on in my TListView. Googling around, I found code from Mr. Zarko Gajic explaining exactly how to do that:
First off, it wouldn't compile correctly on this line:
for ht in hts do
... saying "For loop control variable must be simple local variable". So I just got rid of that section of code, seeing as how it's just a "debug" section anyhow.
The problem lies in the statement:
if hts <= [htOnIcon, htOnItem, htOnLabel, htOnStateIcon] then
... it never seems to get satisfied - no matter where I double-click in my TListView items. Variable "hts" *always* seems to have the value :
... and therefore never satisfies the IF statement. Backtracking a bit in the code, I assume hts is getting bad values because of what it gets fed by ListViewCursosPos.X and ListViewCursosPos.Y. ListViewCursosPos.X seems to have a value of -38 (minus 38) and ListViewCursosPos.Y has a value of -335. That can't be right. Backtracking further from that, the ListView1.ScreenToClient procedure must be feeding it bad values. Anyone have any idea what's going on?