Disabling range selection

I know this is an old issue for wxGrid - not having a way to disable range selection (draggin the mouse in the grid).
I’m messing around with a number game and would like to display my data in a read-only grid, where the user can

click on cells and remove number pairs. That works all fine, but the user can still create a range selection by dragging

the mouse. I’ve found this::

http://osdir.com/ml/lib.wxwidgets.devel/2000-03/msg01746.html

which suggests:

You could of course catch all MouseEvents,
check whether (event.Dragging() && m_cursorMode == WXGRID_CURSOR_SELECT_CELL)
and return, if this is true and call the original ProcessGridCellMouseEvents,
otherwise. No need to replicate that function.

I understand that is in C. How would I go about disabling/overriding the mouse dragging in wxPython?

And something else that you guys might understand and I don’t quite know how to implement::

http://wiki.wxwidgets.org/WxGrid#Changing.2FDisabling_Cell_Highlight

I should say that I’m a beginner to python.

Thanks in advance,

Andrew

Andrew wrote:

I know this is an old issue for wxGrid - not having a way to disable
range selection (draggin the mouse in the grid).
I'm messing around with a number game and would like to display my data
in a read-only grid, where the user can
click on cells and remove number pairs. That works all fine, but the
user can still create a range selection by dragging
the mouse. I've found this::
http://osdir.com/ml/lib.wxwidgets.devel/2000-03/msg01746.html

which suggests:

    You could of course catch all MouseEvents,
    check whether (event.Dragging() && m_cursorMode ==
    WXGRID_CURSOR_SELECT_CELL)
    and return, if this is true and call the original
    ProcessGridCellMouseEvents,
    otherwise. No need to replicate that function.

I understand that is in C. How would I go about disabling/overriding the
mouse dragging in wxPython?

You won't be able to follow those instructions directly since some of that is private in the C++ class, but you can probably still do what you want. The grid class has a GetGridWindow method which returns the subwindow where the grid is drawn, (the other subwindows are for drawing the labels) and you can call Bind on that window to set your own handler for the mouse events. That should cause your event handler to be called before the default handler in the grid class. You can then check what kind of event you are getting and either call event.Skip() to let them go through to the default handler, or do nothing to cause them to be ignored.

And something else that you guys might understand and I don't quite know
how to implement::

wxGrid - WxWiki

That isn't possible with Classic wxPython. OverridingMethods - wxPyWiki

···

--
Robin Dunn
Software Craftsman