buttons are not recreated, sizer to blame?

All,

I have a frame in which I have a panel. In the panel a vertical sizer putting content in the top and buttons in the bottom. So far so good.

Now I want to flip the frame (the panel actually) from show to edit mode. So I do self.DestroyChildren() on the panel and run the function for populating the thing again but now in the edit mode makeTypePanel(self,self.object,self.i18n,'e', self.legalmodes,self)

def makeTypePanel(panel,obj,i18n,basemode, legalmodes,events2):
    #make the sizers:
    box=wx.BoxSizer(wx.VERTICAL)
    buttons=wx.BoxSizer(wx.HORIZONTAL)
    #make the content
    content=makeTypeSubPanel(panel,obj,i18n,basemode,legalmodes,name=typename)

    #and make buttons:
    buttonCommit=wx.Button(panel,-1,doI18N("COMMIT",i18n,typename),name="button_commit")

    buttons.Add(buttonCommit,0,wx.EXPAND|wx.ALIGN_RIGHT)
    buttonDone=wx.Button(panel,-1,doI18N("CANCEL",i18n,typename),name="button_cancel")
     buttons.Add(buttonDone,0,wx.EXPAND|wx.ALIGN_RIGHT)
    box.Add(content,1,wx.EXPAND)
    box.Add(buttons,0,wx.ALIGN_RIGHT)
    panel.SetSizer(box,True)
    panel.Fit()
    panel.Show()

now this gives me a nice refreshed panel with all the content in edit mode but no buttons.

What am I missing here. Should I have removed the sizer (if so how?) or what is happening?

Paul

···

--
Paul Sijben tel: +31334566488
Eemvalley Technology fax: +31334557523
the Netherlands http://eemvalley.com

HI Paul,

I have a frame in which I have a panel. In the panel a vertical sizer
putting content in the top and buttons in the bottom. So far so good.

Now I want to flip the frame (the panel actually) from show to edit
mode. So I do self.DestroyChildren() on the panel and run the function
for populating the thing again but now in the edit mode
makeTypePanel(self,self.object,self.i18n,'e', self.legalmodes,self)

<snip>
<snap>

now this gives me a nice refreshed panel with all the content in edit
mode but no buttons.

What am I missing here. Should I have removed the sizer (if so how?) or
what is happening?

It's a bit hard to say without an actually working sample... At least
for me, I am not good in reading other people code and spot errors on
it :smiley:
Have you tried to call sizer.Layout() or similar? Although I don't
think this is the issue here... please make a small runnable sample
app that demonstrates the problem, I am sure you will get help in this
list :smiley:

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

···

On 5/9/07, Paul Sijben wrote: