Jump to content


Photo

ListView: False row number in A_EventInfo on "DoubleClick"


  • Please log in to reply
3 replies to this topic

#1 just me

just me
  • Members
  • 1223 posts

Posted 04 July 2012 - 03:25 PM

For details look at this thread, please. I confirm the issue for AHK_L 1.1.07.03.

DoubleClick: The user has double-clicked a row. The variable A_EventInfo contains the row number.

In fact, A_EventInfo keeps unchanged whenever the user double-clicks on an empty area within the ListView. The (0-based) iItem member of the NMITEMACTIVATE structure provided by the NM_DBLCLK notification contains -1 in this case, so A_EventInfo has to be set to 0 (1-based row index).

Alternatively AHK might suppress the "DoubleClick" event in this case, because the user has not double-clicked a row (an item).

#2 Lexikos

Lexikos
  • Administrators
  • 8910 posts

Posted 05 July 2012 - 08:40 AM

The documentation should probably say:

The user has double-clicked the ListView. The variable A_EventInfo contains the row number of the first focused row.

Internally, the click, double-click and activate events use this code:
event_info = 1 + ListView_GetNextItem(control.hwnd, -1, LVNI_FOCUSED); [color=green]// Fetch manually for compatibility with Win95/NT lacking MSIE 3.0+.[/color]
This is equivalent:
EventInfo := LV_GetNext(0, "Focused")
Although AutoHotkey_L doesn't run on Win95/NT, changing the behaviour now in v1.1 might break scripts in an obscure way.

#3 just me

just me
  • Members
  • 1223 posts

Posted 05 July 2012 - 11:27 AM

I've also spent some more time on this and found the corresponding statement in the AHK Basic sources, too. I think that ListView_SubItemHitTest() should be called to get correct results. But maybe it will be better not to change it in v1, even though it seems that most scripters who got cought in this trap (including me) have already implemented some workaround.

If it won't be changed in v1, the documentation should say:

The user has double-clicked the ListView. The variable A_EventInfo contains the row number of the focused row.

List-View Item States

LVIS_FOCUSED The item has the focus, so it is surrounded by a standard focus rectangle. Although more than one item may be selected, only one item can have the focus.



#4 Lexikos

Lexikos
  • Administrators
  • 8910 posts

Posted 11 July 2012 - 09:53 AM

Interestingly, the description of the double-right-click event is already accurate:

R: The user has double-right-clicked within the control. The variable A_EventInfo contains the focused row number.
Source: ListView (GUI)