Windows Classic Theme and List Boxes

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

Any ideas?

Something must escape me…

For that sort of thing, I use the listbox.CellClick event. I know which row and which column was clicked without resorting to any other computation.

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.

Don’t I need to supply these values since they are inputs to the function?

I also do not know why this fails only with the Windows Classic theme. I am wondering what other grief this theme will cause.

no. just add the event handler to the listbox and you are all set.

Fantastic! Thank you very much.

just happy I could help.

Does anyone know why the Windows Classic Theme cause an error.