wxSizer: Define sizer hierarchie before putting controls in or vice versa?

P

Piet

Hello,
I have a short question about sizers and how they work when I have a
frame or panel with a complex sizer hierarchie. When creating a new
sizer which sits itself in its parent sizer, should I add the new
sizer to the parent sizer and then populate the new sizer with its
controls (some of them might be sizers on their own) or should I
populate the new sizer with all its controls before I add the new
sizer to its parent sizer? Or doesn´t it make any difference and all
the sizes and sizers are calculated anyways when the
wx.Window.SetSizer(wx.Sizer),wx.Window.SetAutoLayout(True) and
wx.Sizer.Fit(wx.Window) functions are run before before the window is
finally made visible?
Thanx in advance
Peter
 
E

Ed Leafe

Or doesn´t it make any difference and all
the sizes and sizers are calculated anyways when the
wx.Window.SetSizer(wx.Sizer),wx.Window.SetAutoLayout(True) and
wx.Sizer.Fit(wx.Window) functions are run before before the window is
finally made visible?

In my experience, it doesn't make any difference. Perhaps there is a
minor performance advantage one way or the other, but not enough for me
to ever worry about.

___/
/
__/
/
____/
Ed Leafe
http://leafe.com/
http://dabodev.com/
 
T

Tom B.

Piet said:
Hello,
I have a short question about sizers and how they work when I have a
frame or panel with a complex sizer hierarchie. When creating a new
sizer which sits itself in its parent sizer, should I add the new
sizer to the parent sizer and then populate the new sizer with its
controls (some of them might be sizers on their own) or should I
populate the new sizer with all its controls before I add the new
sizer to its parent sizer? Or doesn´t it make any difference and all
the sizes and sizers are calculated anyways when the
wx.Window.SetSizer(wx.Sizer),wx.Window.SetAutoLayout(True) and
wx.Sizer.Fit(wx.Window) functions are run before before the window is
finally made visible?
Thanx in advance
Peter

I like to bunch everything together so its easier to see later.

#
self.linkpanel = wx.Panel(self.notebook,-1)
self.link_thing = LinkListCtrlPanel(self.linkpanel)
txtbox = wx.BoxSizer(wx.HORIZONTAL)
txtbox.Add(self.link_thing, 2, wx.EXPAND)
self.linkpanel.SetSizer(txtbox)
self.linkpanel.SetAutoLayout(1)
txtbox.Fit(self.linkpanel)
self.notebook.AddPage(self.linkpanel, "Links")
#

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top