XYToCell broken for virtual grids

The wxGrid.XYToCell seems to be broken for virtual grids. It doesn't appear to take into account the row and column label sizes or the scroll positions.

Without this, it was impossible to make a virtual grid the target of a DragAndDrop action. This took me a little while to work out, so here is my solution. Note the new XYToCell function in the example below. Comments are welcome :slight_smile:

I assume this is a wxWindows bug, who should be contacted about this?

p.s. this should probably go into the grid wiki or the demos, I am wiki challenged so if somebody could help out ...

Brian Kelley
Whitehead Institute for Biomedical Research

GridDragAndDrop.py (3.51 KB)

Brian Kelley wrote:

The wxGrid.XYToCell seems to be broken for virtual grids. It doesn't appear to take into account the row and column label sizes or the scroll positions.

Without this, it was impossible to make a virtual grid the target of a DragAndDrop action. This took me a little while to work out, so here is my solution. Note the new XYToCell function in the example below. Comments are welcome :slight_smile:

I assume this is a wxWindows bug, who should be contacted about this?

PLease enter a bug report at SF about it, with a category of wxGrid.

p.s. this should probably go into the grid wiki or the demos, I am wiki challenged so if somebody could help out ...

It's very easy, see http://wiki.wxpython.org/index.cgi/HelpContents.

Just edit an exiting page adding a new WikiName for your page, and then click on that new link and then edit your page.

路路路

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Okay. XYToCell is not broken, just poorly documented :slight_smile:

XYToCell, XToCol and YToRow take unscrolled coordinates. On top of that it seems that the grid's labels need to be taken into account for computing the x,y positions. Attached (and also on the wxGrid wiki now, thanks Robin) is the updated DragAndDrop to wxGrid.

Perhaps another addition to the demo? It would have saved me some time :slight_smile:

GridDragAndDrop.py (3 KB)

路路路

--
Brian Kelley bkelley@wi.mit.edu
Whitehead Institute for Biomedical Research 617 258-6191

Brian Kelley wrote:

Okay. XYToCell is not broken, just poorly documented :slight_smile:

XYToCell, XToCol and YToRow take unscrolled coordinates. On top of that it seems that the grid's labels need to be taken into account for computing the x,y positions. Attached (and also on the wxGrid wiki now, thanks Robin) is the updated DragAndDrop to wxGrid.

Thanks for the update.

Perhaps another addition to the demo? It would have saved me some time :slight_smile:

Yep, I've already added it. I'll update it with your new version.

路路路

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!