Removing panels from a sizer/window

David C. Fox wrote:

Will Sadkin wrote:

> I am trying to build a dialog that dynamically adds and/or removes
> panels to itself on request. Adds work fine, but when I remove a
> panel, it doesn't away/get destroyed, and is still accessible in
> the GUI. I don't know where the objects are still referenced and,
> more importantly, how to get rid of them.
> [...]
> Can someone tell me what is going on here, and how do I fix
> this program to "do what I want?"

Removing a control from the sizer doesn't remove it from its parent
window. You have to call panel.Hide() (if you just want to hide the
panel, but possibly bring it back later) or panel.Destroy() after
removing it from the sizer.

Yep, panel.Destroy() does the trick.

Thanks again, David!
/Will Sadkin
Parlance Corporation