Hello Benjamin,
There are about 2 or 3 thing that I modified in your sample, and it is
working.
1) The lines:
self.test1 = wx.StaticText(item, -1, "Description: ")
self.test2 = wx.StaticText(item, -1, "Description2: ")
self.test3 = wx.StaticText(item, -1, "Description3: ")
Are wrong; you can not parent a StaticText, that should be inside your
panel, to the FoldPanel. The correct syntax is:
self.test1 = wx.StaticText(self.panel, -1, "Description: ")
self.test2 = wx.StaticText(self.panel, -1, "Description2: ")
self.test3 = wx.StaticText(self.panel, -1, "Description3: ")
The StaticText controls needs to be inside your self.panel in order to be
managed by the sizer, so their parent must be self.panel.
2) Adding the line:
self.panel.SetSizer(self.sizer)
after the definition of the sizer and;
3) Adding the lines:
self.sizer.Fit(self.panel)
self.sizer.SetSizeHints(self.panel)
self.sizer.Layout()
before using self.sidebar.AddFoldPanelWindow(item, self.panel) did the
trick.
I attach a revised sample, that works.
However, regarding the deletion of the controls inside a sizer in
FoldPanelBar, I have tried to use something like:
# Deleting a control from a FoldPanel, inside a sizer
Sizer.Detach(somecontrol)
somecontrol.Destroy()
sizer.Layout()
And it works. The sizer is correctly layed out after the control
destruction. In any case, it would surprise me a lot that sizer management
afftects FoldPanelBar behavior.
HTH.
Andrea.
(See attached file: test2.py)
test2.py (2.8 KB)
···
_______________________________________________
Andrea Gavana
Reservoir Engineer
MOGI ? Reservoir Characterization and Modeling Dept.
ENI S.p.A. ? Exploration & Production Division
Via Emilia, 1 ? 20097 San Donato Milanese (MI) ? Italy
Phone: +39 02 520 62972
Fax: +39 02 520 61824
E-mail: andrea.gavana@agip.it
Restyled Internet Site: http://xoomer.virgilio.it/infinity77/
____________________________________________________
Eni S.p.A.
Sede legale in Roma,
Piazzale Enrico Mattei 1, 00144 Roma
Tel. centralino: +39 06598.21
www.eni.it
Capitale sociale 4.002.934.326 i.v.
Registro Imprese di Roma,
Codice Fiscale 00484960588
Part. IVA 00905811006
R.E.A. Roma n. 756453