Listbox CellMouseExit & CellMouseEnter

Listbox CellMouseExit(row, column)
Listbox CellMouseEnter(row, column)

Has anyone implemented any such Event Definitions? I have struggled for a few hours trying to make do my own and am having trouble getting them both to work. :slight_smile:

Ok I figured it out something that sort of works. I am hoping someone can review it and see if its working on your end. I am not sure if I am missing something:

Property: LastRow As Integer
Property: NewRow As Integer

Event RowMouseEnter(i as Integer)
Event RowMouseExit(i as Integer)

[code]Sub MouseMove(X As Integer, Y As Integer)
Dim Row As Integer
Dim Col As Integer
Row=Me.RowFromXY(x,y)
Col=Me.ColumnFromXY(x,y)

If Row<0 Or row>=Me.ListCount or LastRow = Row Then

Exit Sub

elseif row <> LastRow then

if LastRow >=0 then
   RaiseEvent RowMouseExit(Lastrow)
end if

lastrow = row
newrow = row

RaiseEvent RowMouseEnter(Row)

end if

End Sub
[/code]

[code]Sub MouseExit()

RaiseEvent RowMouseExit(Lastrow)
LastRow = -1

End Sub
[/code]

[quote=140367:@Joseph Morgan] RaiseEvent RowMouseExit(Lastrow)
LastRow = -1[/quote]
Seems to work perfectly for my system on Windows.

[quote=140367:@Joseph Morgan]Ok I figured it out something that sort of works. I am hoping someone can review it and see if its working on your end. I am not sure if I am missing something:

Property: LastRow As Integer
Property: NewRow As Integer

Event RowMouseEnter(i as Integer)
Event RowMouseExit(i as Integer)

[code]Sub MouseMove(X As Integer, Y As Integer)
Dim Row As Integer
Dim Col As Integer
Row=Me.RowFromXY(x,y)
Col=Me.ColumnFromXY(x,y)

If Row<0 Or row>=Me.ListCount or LastRow = Row Then

Exit Sub

elseif row <> LastRow then

if LastRow >=0 then
   RaiseEvent RowMouseExit(Lastrow)
end if

lastrow = row
newrow = row

RaiseEvent RowMouseEnter(Row)

end if

End Sub
[/code]

[code]Sub MouseExit()

RaiseEvent RowMouseExit(Lastrow)
LastRow = -1

End Sub
[/code][/quote]
I have not tested RowMouseExit.

[quote=140367:@Joseph Morgan]Ok I figured it out something that sort of works. I am hoping someone can review it and see if its working on your end. I am not sure if I am missing something:

Property: LastRow As Integer
Property: NewRow As Integer

Event RowMouseEnter(i as Integer)
Event RowMouseExit(i as Integer)

[code]Sub MouseMove(X As Integer, Y As Integer)
Dim Row As Integer
Dim Col As Integer
Row=Me.RowFromXY(x,y)
Col=Me.ColumnFromXY(x,y)

If Row<0 Or row>=Me.ListCount or LastRow = Row Then

Exit Sub

elseif row <> LastRow then

if LastRow >=0 then
   RaiseEvent RowMouseExit(Lastrow)
end if

lastrow = row
newrow = row

RaiseEvent RowMouseEnter(Row)

end if

End Sub
[/code]

[code]Sub MouseExit()

RaiseEvent RowMouseExit(Lastrow)
LastRow = -1

End Sub
[/code][/quote]
I do not think RowMouseExit works 100%.

Thank you Oliver, I will check it out.