I have a list box, and I use the code below to determine which cell was clicked. The code works fine on Macs, and all versions of Windows, with the exception of Windows 7 with the Windows Classic Theme installed. In this case, an endless loop in created.
m=Me.RowFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
n=Me.ColumnFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
if n=-1 then
headerHeight = 0
i = spDataInput.rowFromXY(1,headerHeight)
while spDataInput.rowFromXY(1,headerHeight) < 0
headerHeight = headerHeight + 1
i = spDataInput.rowFromXY(1,headerHeight)
if headerHeight>30 then
b = true
n=-1
m=-1
end if
wend
if b = false then
headerHeight = headerHeight - 1
n=me.ColumnFromXY(x,headerHeight + 1)
end if
end if
I need to know the cell clicked. I appears cellclick is boolean, and I would have to loop through the cells to find the cell clicked using this function.
The event is boolean, but within the event you have the row and the column as integers.
ListBox.CellClick(Row as Integer, Column as Integer, X as Integer, Y as Integer) As Boolean
If you insist on using n and m, let’s assume that n and m are integer properties of the window. In the listbox.cellclick event I would just have this code:
Window.n = Row
Window.m = Column
that’s it. Your code is really cool, but you really have it all done for you in the listbox.