(no subject)

it seems when I remove a sizer from a sizer, it gets
destroyed… how can I avoid this? I want to remove sizerB from
sizerA and add it to sizerC.

I have some code that does a bunch of auto population of UI,
but I want to do some minor customizations of very specific pieces of UI after
the auto population, and most of that involves removing sizers from other
sizers, and putting them into different sizers.

Hello,

2009/3/18 Hamish McKenzie::

it seems when I remove a sizer from a sizer, it gets destroyed... how can I
avoid this? I want to remove sizerB from sizerA and add it to sizerC.

From the wxWidgets documentation:

wxSizer::Remove
bool Remove(wxWindow* window)
bool Remove(wxSizer* sizer)
bool Remove(size_t index)

Removes a child from the sizer and destroys it if it is a sizer or a
spacer, but not if it is a window (because windows are owned by their
parent window, not the sizer).

If you want to keep your sizerB alive,Detach()ing it from sizerA and
adding it to sizerC.

Andrea.

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

Hamish McKenzie wrote:

it seems when I remove a sizer from a sizer, it gets destroyed... how can I avoid this? I want to remove sizerB from sizerA and add it to sizerC.

I have some code that does a bunch of auto population of UI, but I want to do some minor customizations of very specific pieces of UI after the auto population, and most of that involves removing sizers from other sizers, and putting them into different sizers.

1) If you want to ask a new question, then do not reply to an old one...it gets confusing when you do that.
2) You are probably looking for sizer.Detach(). Try something like:

sizerA.Detach(sizerB)
sizerC.Insert(sizerB)

Theoretically, this should work See the docs for more info: wxPython API Documentation — wxPython Phoenix 4.2.2 documentation

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org