I need to know when the mouse cursor is over a header cell or if it has just been clicked.
I though I could do it with “Column and Row FromXY”, and as I couldn’t do it I went to the Feedback just in case there was a reported bug about this subject. But what I found was a feature request from 2009 (#10277). The status is “verified”, but it seems that nothing has been done.
Of course, I can create my function to get the column of the header from XY, but I wanted to ask you all if you had already done it in an easier way.
Thanks for any help.
Function HeaderColumn(extends LB as ListBox, X as Integer, Y as integer) As Integer
'Returns the Header column according to X,Y
'If X,Y is not on the Header it returns -1
If LB = Nil Then Return -1
If Y > LB.HeaderHeight Then Return -1
Var LeftLB As Integer = LB.Window.Left + LB.Left
Var Left As Integer
For c As Integer = 0 To LB.LastColumnIndex
Left = Left + LB.ColumnAt(c).WidthActual
If Left > x Then Return c
I don’t know if it works with ContainerControls, but fortunately it is not a problem now.
Thank you Tim. You are right and, in fact, I was not aware of this event.
However my situation is a bit different. I was hovering the mouse over the header and I wanted to use the X,Y of the MouseMove event to know over which Header column I was. Without “pressing” it.