Hi,
Using version 12.1.1 the listview HitTest method seems to return the first visible item, not the one at X,Y. Something's wrong so suggest CJ make sure fixed before next release.
If anyone needs correct code then this works:
Private Const LVM_FIRST As Long = &H1000
Private Const LVM_HITTEST As Long = (LVM_FIRST + 18)
Private Const LVM_SUBITEMHITTEST As Long = (LVM_FIRST + 57)
Private Const LVHT_NOWHERE As Long = &H1
Private Const LVHT_ONITEMICON As Long = &H2
Private Const LVHT_ONITEMLABEL As Long = &H4
Private Const LVHT_ONITEMSTATEICON As Long = &H8
Private Const LVHT_ONITEM As Long = (LVHT_ONITEMICON Or _
LVHT_ONITEMLABEL Or _
LVHT_ONITEMSTATEICON)
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type LVHITTESTINFO
pt As POINTAPI
flags As Long
iItem As Long
iSubItem As Long 'ie3+ only .. was NOT in win95.
'Valid only for LVM_SUBITEMHITTEST
End Type
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Public Function ExtremeListView_HitTest(lv As XtremeSuiteControls.ListView, x As Long, y As Long) As XtremeSuiteControls.ListViewItem
Dim HTI As LVHITTESTINFO
' Set ExtremeListView_HitTest = lv.HitTest(x, y) - this is broken
With HTI
.pt.x = (x)
.pt.y = (y)
.flags = LVHT_ONITEM
End With
Call SendMessage(lv.hwnd, LVM_SUBITEMHITTEST, 0, HTI)
If HTI.iItem > -1 Then
Set ExtremeListView_HitTest = lv.ListItems(HTI.iItem + 1)
End If
End Function
------------- ExtremeSuitePro 12.1.1
WinXP SP3
|