[wxPython-users] Finding which control has focus

Robin Dunn robin at alldunn.com
Wed Oct 3 13:51:07 PDT 2007


Larry Bates wrote:
> I have a frame that contains 6 controls: ComboBox, ExpandoTextCtrl, and 
> 2 list controls, cancel button, send button.  I want to know if there is 
> some way to
> trap the fact that a user clicked the mouse on the ComboBox, 
> ExpandoTextCtrl or
> either of the 2 list controls.  I would like to make the label bold to 
> show which control has the focus.  onSetFocus/onKillFocus doesn't fire 
> when you click on these controls.  I can't even get it to fire when I do 
> MyExpandoTextCtrl.SetFocus() (but the focus does change) Is there some 
> other way?  I don't have these on separate windows or panels.


How are you binding the events to those methods?  (Some sample code is 
worth 1000 words...)

To answer the question in your Subject, there is the wx.Window.FindFocus 
static method.


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





More information about the wxpython-users mailing list