Composite Windows and EVT_SET_FOCUS

Hello, I have a composite window (representing a repeating group)
that has a text box and a button. I'd like the TAB key to
scroll through 5 of these composites, only stopping on the
text boxes (and the OK,Cancel button which it currently does).

At this time, by just placing the composite window I
can press TAB 5 times without focus showing, and then
it moves to OK, Cancel and then another 5 times
(through each composite control).

Question: How to I catch the focus event for the
           composite window and pass it on to
           the text box?

Thanks!

Clark

P.S. Is there a good way to manage a control of arrays,
        should I be using a tuple?
P.S.S. Here is the source code...

class MyOpenFileHelper(wxWindow):
    def __init__(self,parent,id,pos,mode,label):
        wxWindow.__init__(self,parent,id,pos,wxSize(400,30))
        self.mode = mode
        wxStaticText(self, -1, label,
                     wxPoint(0,5),wxSize(75,25),wxALIGN_RIGHT)
        self.text = wxTextCtrl(self,-1,"",wxPoint(75,0),wxSize(200,25))
        wxButton(self,10,"Change",wxPoint(275,0))
        EVT_BUTTON(self, 10, self.OnClick)
        EVT_SET_FOCUS
        
    def OnClick(self, event):
        dlg = wxFileDialog(self, "Choose a file", ".",
                           self.text.GetValue(), "*.xml", self.mode)
        if dlg.ShowModal() == wxID_OK:
            if os.path.exists(dlg.GetPath()):
                self.text.SetValue(dlg.GetPath())
        dlg.Destroy()

    def OnSetFocus(self,event):
        wxMessageBox("Focus!")
        self.text.SetFocus()

    def SetValue(self,str):
        self.text.SetValue(str)
        self.text.SetInsertionPoint(0)

    def GetValue(self): return self.text.GetValue()
    
class MyOpenFile(wxDialog):
    def __init__(self, parent,mode):
        if mode is wxOPEN:
            wxDialog.__init__(self,parent, -1, "Open Files",
                              wxDefaultPosition, wxSize(450, 250))
        else:
            if mode is wxSAVE:
                wxDialog.__init__(self,parent, -1, "Save Files",
                                  wxDefaultPosition, wxSize(450, 250))
            else:
                raise TypeError("Expected wxOpen or wxSave")
        self.mode = mode
        self.metaxslt =
         MyOpenFileHelper(self,-1,wxPoint(20,5),self.mode,"Meta X&SLT:")
        self.metadata =
         MyOpenFileHelper(self,-1,wxPoint(20,35),self.mode,"Meta D&ATA:")
        self.maindata =
         MyOpenFileHelper(self,-1,wxPoint(20,65),self.mode,"Main &XSLT:")
        self.mainxslt =
         MyOpenFileHelper(self,-1,wxPoint(20,95),self.mode,"Main &DATA:")
        self.output =
          MyOpenFileHelper(self,-1,wxPoint(20,125),self.mode,"&Output:")
        wxButton(self, wxID_OK, " OK ", wxPoint(75, 175),
                       wxDefaultSize).SetDefault()
        wxButton(self, wxID_CANCEL, " Cancel ", wxPoint(200, 175),
                      wxDefaultSize)

Hello, I have a composite window (representing a repeating group)
that has a text box and a button. I'd like the TAB key to
scroll through 5 of these composites, only stopping on the
text boxes (and the OK,Cancel button which it currently does).

At this time, by just placing the composite window I
can press TAB 5 times without focus showing, and then
it moves to OK, Cancel and then another 5 times
(through each composite control).

Question: How to I catch the focus event for the
           composite window and pass it on to
           the text box?

Use a wxPanel instead of a wxWindow for the base class of your composite.
It automatically handles passing focus between its children and to/from its
siblings.

The reason you are not seeing focus events is you only did EVT_SET_FOCUS,
not EVT_SET_FOCUS(self, self.OnSetFocus).

BTW, have you seen filebrowsebutton.py in the wxPython library? It is very
similar to what you are trying to do.

···

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