hi,
This section is cut out of the onlinedocs for class wxWindow:
···
______
wxWindow::SetSizer
void SetSizer(wxSizer* sizer)
Sets the window to have the given layout sizer. The window will then own the object, and will take care of its deletion. If an existing layout constraints object is already owned by the window, it will be deleted.
_____
Hm, sounds simple to me. But if i try to to that - the solution looks like if it isn't so easy... if i call window.SetSizer() twice in a app, wx will place all new controls in the upper left corner of the parent.
ok. i don't wanna exactly do this in that way. i choose the slow way. i wanna delete all the items of the parent (a wxPanel) by myself and set a new sizer with controls on it.
I can't delete the panel because of some circumstances.... if i can delete the panel, i think there would be no problem with a new panel. But the panel is linked with a couple of other objects... i currently use this code:
wxBeginBusyCursor()
#self.temppanel is a list of panels
self.temppanel[sel].DestroyChildren()
# self.filliste is a list of functions which will create a sizer with some
# controls on it and return the rootsizer. The args which the function needs is
# the panel and true(resize panel?)
self.filliste[sel](self.temppanel[sel],true)
self.temppanel[sel].SetAutoLayout(true)
self.mysizer.SetMinSize(self.mysizer.CalcMin())
self.parent.Layout()
frametools.form1_adjustscrollbars()
wxEndBusyCursor()
The Program do this once, twice, but sometimes it crashs hardly....
why? is there another way to delete all children of a panel?? hmm
why the behaviour describe in the docs doesn't appear?
i hope i gave all infos you need to solve this problem. i try myself again, but i tried
a variety of ways and nothing useful happens...
thx, reen
----
Rene Freund nur ein toter bug ist ein guter bug
rene@meder.de