wxPython Grid XY Coordinates question

K

Kiran

Hello All,
I am writing an app in wxPython using a grid. I need to be able to
recognize what cell in the grid the user is hovering over with the
mouse. How to do this?
I tried XYToCell(x, y), but that doesnt work properly because it
thinks that mouse position (0, 0) is the first cell in the grid, and
then goes from there, so if i move the grid to a differernt area on the
screen, the XYToCell is messed up in what it returns.

Any ideas on how to get this to work or any other way?

thanks,
Kiran
 
W

Will McGugan

Kiran said:
Hello All,
I am writing an app in wxPython using a grid. I need to be able to
recognize what cell in the grid the user is hovering over with the
mouse. How to do this?
I tried XYToCell(x, y), but that doesnt work properly because it
thinks that mouse position (0, 0) is the first cell in the grid, and
then goes from there, so if i move the grid to a differernt area on the
screen, the XYToCell is messed up in what it returns.

Any ideas on how to get this to work or any other way?

XYToCell probably takes window (client) coordinates. If you have the
mouse position in screen coordinates, you will need to convert them with
the ScreenToClient for your grid.

Will McGugan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,005
Messages
2,570,264
Members
46,859
Latest member
HeidiAtkin

Latest Threads

Top