wxGrid and "hotkeys" event handler

Hi friends,

I have some question for you... :slight_smile: I have a grid table and I want define some kind of "hotkey", for example if I push the "Enter" button on a selected cell than the selection should switch to editing mode. And also I want some kind of event handler for a "Delete" button so I can define function for this, for example delete the selected row. The qustion is how to realise this? Maybe there is any other solution for this kind of task?

Thanks in advance!

Regards,
Basil Shubin.

Basil Shubin wrote:

Hi friends,

I have some question for you... :slight_smile: I have a grid table and I want define some kind of "hotkey", for example if I push the "Enter" button on a selected cell than the selection should switch to editing mode. And also I want some kind of event handler for a "Delete" button so I can define function for this, for example delete the selected row. The qustion is how to realise this? Maybe there is any other solution for this kind of task?

Catch the grid's EVT_KEY_DOWN event and process your "hotkeys" there. When a key is pressed while the grid has the focus then your handler will be called. be sure to call event.Skip() for any keys that you don not handle yourself so the default functionality will still be done. There is an example of doing something with the grid's EVT_KEY_DOWN event in the demo in the GridEnterHandler module.

···

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