Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - Listview HitTest method is broken.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Listview HitTest method is broken.

 Post Reply Post Reply
Author
Message
ijwelch View Drop Down
Senior Member
Senior Member


Joined: 20 June 2006
Status: Offline
Points: 262
Post Options Post Options   Thanks (0) Thanks(0)   Quote ijwelch Quote  Post ReplyReply Direct Link To This Post Topic: Listview HitTest method is broken.
    Posted: 14 September 2009 at 2:59am
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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.