Layout/tab control question

I've got a section of the app I'm porting that consists of five rows that
look like:

LABEL1 [Text Entry]
LABEL2 [Text Entry]
...

I've got it currently laid out with a wxGridSizer, and that's working
almost right. However, I can't use the tab key to switch between fields
in this area.

From searching around, it appears that I need a wxPanel in order to get

the tabbing.

My question is: To get the nice, aligned layout I get through
wxGridSizer, do I need to lay my widgets out in the GridSizer, and then
add that sizer to the panel, or do I need to skip the GridSizer entirely
and just use a Panel?

Thanks,
Wade

···

--
If you have a VCR or MP3 player, you need to read these links:

http://digitalspeech.org/
http://www.libertyboard.org/

#!/usr/bin/env python
from wxPython.wx import *

class MyPanel(wxPanel):
    def __init__(self, parent):
        
        # create panel
        wxPanel.__init__(self, parent, id=-1)
        
        # create the controls
        st1 = wxStaticText(self, -1, "Label1")
        st2 = wxStaticText(self, -1, "Label2")
        field1 = wxTextCtrl(self, -1, size=(50,-1))
        field2 = wxTextCtrl(self, -1, size=(50,-1))

        # create the sizer
        sizer1 = wx.wxGridSizer(cols=2, hgap=5)

        # add controls to sizer
        sizer1.Add(st1, 1, wxEXPAND)
        sizer1.Add(field1, 1, wxEXPAND)
        sizer1.Add(st2, 1, wxEXPAND)
        sizer1.Add(field2, 1, wxEXPAND)

        # enable sizers
        self.SetSizer(sizer1)
        self.SetAutoLayout(1)
        sizer1.Fit(self)
        sizer1.SetSizeHints(self)

class MyFrame(wxFrame):
    def __init__(self):
        wxFrame.__init__(self, None, -1, 'Sizer Demo')
        panel1 = MyPanel(self)
        # try uncommenting the following lines
## sizer = wxBoxSizer()
## sizer.Add(panel1, 1, wxEXPAND)
## self.SetSizer(sizer)
## self.SetAutoLayout(1)
## sizer.Fit(self)
## sizer.SetSizeHints(self)

class MyApp(wxApp):
    def OnInit(self):
        frame = MyFrame()
        frame.Show(1)
        return 1

app = MyApp(0)
app.MainLoop()

···

--- "H. Wade Minter" <minter@lunenburg.org> wrote:

I've got a section of the app I'm porting that consists of five
rows that look like:

LABEL1 [Text Entry]
LABEL2 [Text Entry]
...

I've got it currently laid out with a wxGridSizer, and that's
working almost right. However, I can't use the tab key to
switch between fields in this area.

From searching around, it appears that I need a wxPanel in order
to get the tabbing.

My question is: To get the nice, aligned layout I get through
wxGridSizer, do I need to lay my widgets out in the GridSizer,
and then add that sizer to the panel, or do I need to skip the
GridSizer entirely and just use a Panel?

=====
Donnal Walter
Arkansas Children's Hospital

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus � Powerful. Affordable. Sign up now.