OnKey binding Question

Hello All.
  I'd like to have a form with like 5 or so text controls for data-entry.
I'd like to have an OnKey routine, so I can bind an EVT_KEY_DOWN (probably
not to the specific text controls, but just binding in general to the form,
like self.Bind(wx.EVT_KEY_DOWN, self.OnKey). Is there a way, in the def
OnKey routine, that I can determine the name of the text control from which
the OnKey routine was called?

Thanks so much!
Dave

GMane Python wrote:

Hello All.
  I'd like to have a form with like 5 or so text controls for data-entry.
I'd like to have an OnKey routine, so I can bind an EVT_KEY_DOWN (probably
not to the specific text controls, but just binding in general to the form,
like self.Bind(wx.EVT_KEY_DOWN, self.OnKey). Is there a way, in the def
OnKey routine, that I can determine the name of the text control from which
the OnKey routine was called?

Key events are only sent to the widget with the focus, so you will need to bind it to each of the text controls. However you can bind all of them to the same handler if you want and use event.GetEventObject to find out which one the event was sent to.

···

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