There's no MouseMove event for individual rows of a Listbox and I know no other way you could work this. Maybe someone else knows of a way. You could, of course, use a combobox and keep it dropped down all the time.
There's no MouseMove event for individual rows of a Listbox and I know no other way you could work this. Maybe someone else knows of a way. You could, of course, use a combobox and keep it dropped down all the time.
A late reaction, maybe some found already an other solution. I used this one:
Got some code to find out the position of the mousepointer.
from http://www.freevbcode.com/ShowCode.Asp?ID=1120 Option Explicit Private Type POINTAPI X As Long Y As Long End Type Private Declare Function GetCursorPos Lib "user32" _ (lpPoint As POINTAPI) As Long
'*********************** 'THESE TWO FUNCTIONS RETURN THE POSITION ON THE SCREEN 'IN PIXELS, OF THE CURSOR 'EXAMPLE USAGE: 'Private Sub Form_MouseMove(Button As Integer, _ 'Shift As Integer, X As Single, Y As Single) ' Label1.Caption = "X Screen Position = " & GetXCursorPos ' Label2.Caption = "Y Screen Position = " & GetYCursorPos 'End Sub '*********************************** Public Function GetXCursorPos() As Long Dim pt As POINTAPI GetCursorPos pt GetXCursorPos = pt.X End Function Public Function GetYCursorPos() As Long Dim pt As POINTAPI GetCursorPos pt GetYCursorPos = pt.Y End Function
Then in the On MouseMove event off the Listbox, I putted a script like this:
Private Sub lstbox1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Label1.Caption = "X Screen Position = " & GetXCursorPos Label2.Caption = "Y Screen Position = " & GetYCursorPos 'create 2 labels to find out the cursorposition Me.lstbox1.SetFocus Select Case GetYCursorPos Case 83 To 105 'the numbers you got from the labels Me.lstbox1= 1 Case 106 To 126 Me.lstbox1= 2 Case 127 To 147 Me.lstbox1= 3 Case 148 To 169 Me.lstbox1= 4 Case 170 To 194 Me.lstbox1= 5 Case Else Me.lstbox1= 0 End Select End Sub