[wxPython] Re: Using tab to change focus

James Shaw wrote:

I have several text controls in a panel, and I want to be able to switch
between them by pressing tab. The problem is when some controls are greyed
out - pressing tab still gives them focus (you cannot see the caret), and
pressing tab once more brings the caret to the next enabled text ctrl.

This does not seem like correct behavior to me. How could I change or
override it?

I bet, it's some other control, not the disabled one...
Try installing this Idle handler to see whats going on:

    def OnIdle(self, event):
        f = wxWindow_FindFocus()
        if f:
            print "Focus:", f.GetClassName()

···

Thanks,

James Shaw

--------

You are right - the focus is not going to the disabled text control - it is going to wxPanel - I guess this is the parent panel of the text ctrls. What governs the behavior of pressing TAB and how can I modify it?

Cheers,
James Shaw

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

You are right - the focus is not going to the disabled text control - it

is

going to wxPanel - I guess this is the parent panel of the text ctrls.

What

governs the behavior of pressing TAB and how can I modify it?

wxPanel is supposed to always give it to one of its children so this smells
like a bug. Please create a small sample that reproduces the problem so it
can be tracked down.

···

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