Hi
Is it possible to disable multi-row selects in a grid?
I want to use the grid to display fixed data so I've intercepted
left/right clicks and just select the row that was clicked in (grid is in
row select mode anyway).
However, if the mouse is dragged in a cell then a range selection is done
from the first cell.
You can see the effect in GridSimple.py from the demo if you change the
handler for OnCellLeftClick to:
def OnCellLeftClick(self, evt):
self.log.write("OnCellLeftClick: (%d,%d) %s\n" %
(evt.GetRow(), evt.GetCol(), evt.GetPosition()))
self.SelectRow(evt.GetRow(), addToSelected = False)
evt.Veto()
Clicking on a cell selects the whole row, but if you click and drag
/within a cell/ you get a selection block appear from the first cell to
the cell you are dragging in.
I've looked at the grid source code from wxWidgets (grid.cpp) and it
appears that it's in the code at wxGrid::ProcessGridCellMouseEvent -
first, highlighting while dragging and then selecting when drag is
finished. There doesn't appear to be any hooks to disable drag
selection there.
Do I have to process all the mouse events myself, intercepting them before
they reach the grid?
Hugh