Listbox mouseover

Hello,

i want to make a mouseover to a listbox:

in MouseMove event i got:


mX  = Me.RowFromXY(X, Y)
my  = Me.ColumnFromXY(X, Y)

if (mx<>-1) then
  me.CellTag(mx,0)="hover"
  
  for i as Integer=0 to me.ListCount-1
    if i<>mx then
      me.CellTag(i,0)=""
    end if
    
  next
end if

and in cellBackgroundPaint:

if Me.CellTag(row, 0 ) = "hover" Then
  g.ForeColor = app.listboxMouseOver
  g.FillRect(0, 0, g.Width, g.Height)
End If

it works, but is there any better (or simpler) way to set all other rows to CellTag(i,0)="" in a for…next loop?
Or, at all, another way than using cell tag?

try

me.cellTag(-1,0)=""
me.cellTag(mx,0)="Hover"

NOTE : totally untested

thanks, but this throws an outOfBounds exception…

I’d make a subclass of Listbox, add a property for HoverRow as Integer, then set that in MouseMove. That’s essentially what I do for GraffitiListbox.

much better, thanks!

Happy to help!