Catching ESC key in grid?

Hello,

Could someone tell me how I can catch the pressing
of the escape key in a grid? I am guessing that
the grid captures these events for its own use and
doesn't propagate them? Any way around this?

What I want to do is mimic MS Access behavior where
typing the <Esc> key reverts the current cell edit
(which wx.Grid already does just fine), or when typed
when no edit is in progress, reverts changes made to
the row and not yet written to my database. Obviously
my code needs to handle this case.

Attached is my non-working attempt to do this.
Any advice will be most welcome!

grid-esc.py (744 Bytes)

Stuart McGraw wrote:

Hello,

Could someone tell me how I can catch the pressing
of the escape key in a grid? I am guessing that
the grid captures these events for its own use and
doesn't propagate them? Any way around this?

What I want to do is mimic MS Access behavior where typing the <Esc> key reverts the current cell edit
(which wx.Grid already does just fine), or when typed when no edit is in progress, reverts changes made to
the row and not yet written to my database. Obviously
my code needs to handle this case.

Attached is my non-working attempt to do this.
Any advice will be most welcome!

Try wx.EVT_KEY_DOWN instead.

···

--
Robin Dunn
Software Craftsman

Robin Dunn wrote:

Stuart McGraw wrote:

Could someone tell me how I can catch the pressing
of the escape key in a grid? I am guessing that
the grid captures these events for its own use and
doesn't propagate them? Any way around this?
[...]

Try wx.EVT_KEY_DOWN instead.

Works fine, thanks very much. (Though I wonder now why I didn't think of that! :slight_smile: