Problem with RowFromXY / ColumnFromXY

HI

I’m on a Mac running Catalina and the latest version of Xojo.
I’m rewriting an app and at the same time changing it to API2, although I don’t know if that’s significant for this problem.
My main window is resizable and has a number of listbox, 2 of which I have implemented the doubleClick event. In both of those I use RowFromXY and ColumnFromXY to identify the cell double clicked. Both return -1 for the row and column.
I still have the source for the original API1 version of the program and it still works, even if recompiled.
After trying various things, checking the documentation and so on I turned off resizing for the window and it worked properly.
I turned that back on and adjusted the maximum resize options on the window to make it match the API1 version and that sorted one of the listboxes but not the other.
I’ve got round the still failing listbox by getting the row and column in the CellClick event, but this doesn’t seem right.

Anyone have any ideas?

Jack

I’ve discovered it’s easier to store the X and Y in the MouseDown event, and then check them in the DoubleClick event.

the x,y in the mouse event is a position from the left,top of the control whereby MouseX, MouseY is a coordinate from the inner window edge. and System.MouseX, System.MouseY exists also.

Yes, and that’s what you need to pass to RowFromXY. If you use the global mouse position you have to do math to get the control-local position.

Update: Also, remember that you can only get rows that exist. If the user clicks in the empty space below your last row you will get -1.

Can you reproduce the issue in a small sample project?

Using the MouseDown event has cured the problem.

Thanks for the feedback.

That’s true, but, as for the original question, you won’t get a DoubleClick event in the empty space either.

I haven’t tried to create a small project that recreates the issue, not yet anyway. I’m not convinced I will be able to. As I said in my original post, restricting the amount of resizing partially cured it, and turning off resizing cured it completely, both of which seems bizarre. Anyway, using the MouseDown event got me round the problem.