[wxPython] Using TAB between controls in FRAME

Hi,
I have a dialog(Frame) which I use to log into an application (code supplied below). I have changed so that I use the wxFlexGridSizer. It seems to work, however I seem to have lot the possiblity to step to next control (edit area) by using the TAB key. Any hints how to get this feature back.

Also is it possible to set the background color of the frame (say to white) ?

Thanks for any help.
Nikolai Kirsebom

class LoginFrame(wxFrame):
    def __init__(self, parent, id, title, fw):
        self.Fw = fw
        # First, call the base class' __init__ method to create the frame
        wxFrame.__init__(self, parent, id, title) #, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL )
        EVT_CLOSE(self, self.OnCloseWindow)
        
        gs = wxFlexGridSizer(4, 2, 10, 5) # rows, cols, hgap, vgap
        self.Dsn = wxTextCtrl(self, -1, fw.Dsn, wxPoint(4, 4), wxDefaultSize, wxTE_READONLY)
        self.User = wxTextCtrl(self, -1, fw.UserName)
        self.Password = wxTextCtrl(self, -1, "", wxPoint(4, 4), wxDefaultSize, wxTE_PASSWORD)

        gs.AddMany(
            [(wxStaticText(self, -1, LU_T("Database")), 0, wxEXPAND),
             (self.Dsn, 0, wxEXPAND),
             (wxStaticText(self, -1, LU_T("User")), 0, wxEXPAND),
             (self.User, 0, wxEXPAND),
             (wxStaticText(self, -1, LU_T("Password")), 0, wxEXPAND),
             (self.Password, 0, wxEXPAND),
             (wxButton(self, wxID_OK, LU_T("Ok")), 0, wxALIGN_BOTTOM | wxALIGN_LEFT),
             (wxButton(self, wxID_CANCEL, LU_T("Cancel")), 0, wxALIGN_BOTTOM | wxALIGN_RIGHT),
            ])
         gs.AddGrowableCol(1)
        
        self.sizer = gs
        self.sizer.Fit(self)
        self.SetAutoLayout(true)
        self.SetSizer(gs)
        
        EVT_BUTTON(self, wxID_OK, self.OnOk)
        EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)

···

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users

Nikolai Kirsebom wrote:

Hi,
I have a dialog(Frame) which I use to log into an application (code supplied below). I have changed so that I use the wxFlexGridSizer. It seems to work, however I seem to have lot the possiblity to step to next control (edit area) by using the TAB key. Any hints how to get this feature back.

I believe a wxTextCtrl and a wxButton needs to have a wxPanel as a
parent to enable the TAB key to work.

I hope this helps.

Roland Schlenker

···

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users

I have a dialog(Frame) which I use to log into an application
(code supplied below). I have changed so that I use the
wxFlexGridSizer. It seems to work, however I seem to have lot
the possiblity to step to next control (edit area) by using the
TAB key. Any hints how to get this feature back.

The wxPanel is what provides the tab traversal functionality, so put the controls on a panel instead of the frame, and make the panel be the only child of the frame. Also, call SetSizer and SetAutoLayout on the panel instead of the frame.

Also is it possible to set the background color of the frame
(say to white) ?

    panel.SetBackgroundColour(wxWHITE)
or
    panel.SetBackgroundColour("WHITE")
or
    panel.SetBackgroundColour("#FFFFFF")

···

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

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users