Re: [RE: [wxPython] Re: laying out a dialog box]

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [RE: [wxPython] Re: laying out a dialog box]

Niki Spahiev-3
I tryed Cristian's code with 2 buttons in panel. I need similar setup:
panel within panel, but tab traversal is not ok. Only last button gets focus.
Can someone help?

thanks,
Niki Spahiev

____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1

#- <00> -----------------------------------------------------------------------
# Archivo           : demo.py -- 17/12/1999

from wxPython.wx import *

#- <00> -----------------------------------------------------------------------

class MyDialog(wxDialog):
    def __init__(self,parent,title):
        wxDialog.__init__(self,parent,-1,title)

        box = wxBoxSizer(wxVERTICAL)

        box1 = wxBoxSizer(wxHORIZONTAL)
        # You can put your widgets here
        widget = wxPanel(self,-1,size=(200,200))
        wxButton( widget,-1,"B1B1",pos=(10,10),size=(80,20) )
        wxButton( widget,-1,"B2B2",pos=(10,40),size=(80,20) )
        box1.Add(widget,0,wxALL,5)
        box.Add(box1,0,wxALL,2)
       
        boxX = wxBoxSizer(wxHORIZONTAL)
        okbut = wxButton(self,wxID_OK,"Aceptar")
        okbut.SetDefault()
        boxX.Add(okbut,0,wxALL,5)
        boxX.Add(wxButton(self,wxID_CANCEL,"Cancelar"),0,wxALL,5)
        box.Add(boxX,0,wxCENTER)

        self.SetAutoLayout(true)
        self.SetSizer(box)
        box.Fit(self)
        box.SetSizeHints(self)

#- <00> -----------------------------------------------------------------------

class MainFrame(wxFrame):
    def __init__(self, parent,title):
        wxFrame.__init__(self, parent, -1, title,
                         wxDefaultPosition, wxSize(400,300))
       
        mainmenu = wxMenuBar()
        menu = wxMenu()
        menu.Append(100,"Dialog...","Display Dialog")
        mainmenu.Append(menu, "&Archivo")
        self.SetMenuBar(mainmenu)
        EVT_MENU(self,100,self.OnDisplayDialog)
       
        self.Center(wxBOTH)

    def OnDisplayDialog(self,event):
        dlg = MyDialog(self,"Dialog Sample")
        dlg.Center(wxBOTH)
        opcion = dlg.ShowModal()
        dlg.Destroy()

    def OnCloseWindow(self,event):
        self.Destroy()

#- <00> -----------------------------------------------------------------------

class MainApp(wxApp):
    def OnInit(self):
        frame = MainFrame(NULL,"Wx-Template")
        frame.Show(true)
        self.SetTopWindow(frame)
        return true

#- <00> -----------------------------------------------------------------------

def main():
    app = MainApp(0)
    app.MainLoop()

#- <99> -----------------------------------------------------------------------

if __name__ == '__main__':
    main()

Reply | Threaded
Open this post in threaded view
|

RE: [RE: [wxPython] Re: laying out a dialog box]

Cristian Echeverria
Hi Niki...
I think you don´t need another panel, because you
can do all the layout only with sizers (this way you
don´t need to hard code any position)
The wxPanel I puted on the demo was just a sample...

here is my version of your app...

Cristian Echeverria

----- Original Message -----
From: Niki Spahiev <[hidden email]>
To: <[hidden email]>
Sent: Friday, December 17, 1999 10:16 PM
Subject: Re: [RE: [wxPython] Re: laying out a dialog box]


I tryed Cristian's code with 2 buttons in panel. I need similar setup:
panel within panel, but tab traversal is not ok. Only last button gets
focus.
Can someone help?

Demo-o-c2.py (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [RE: [wxPython] Re: laying out a dialog box]

Robin Dunn
In reply to this post by Niki Spahiev-3
> I tryed Cristian's code with 2 buttons in panel. I need similar
> setup: panel within panel, but tab traversal is not ok. Only last
> button gets focus.  Can someone help?


This surprises me.  There was a lot of work in the 2.1.9 - 2.1.11 timeframe
to make controls on nested panels tab correctly.

Your sample does tab correctly here for me so if you've found a fluke then it
seems to have been fixed in the current code.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!




_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users