destroy and recreate window contents

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Jacek Poplawski
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Jun 20, 2011 12:03 pm

destroy and recreate window contents

Post by Jacek Poplawski » Sun Nov 25, 2012 6:36 pm

I want to dynamically destroy/create window contents.

If I understand correctly wxWindow::DestroyChildren destroys all children, but not sizer.
So if I create new wxSizer and call wxWindow::SetSizer - what will happen with old sizer? Memory leak?

Is it a proper way to recreate window contents or is there better solution? Could you point me to any article on example?

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Re: destroy and recreate window contents

Post by Auria » Sun Nov 25, 2012 7:20 pm

The easiest way is probably to remove the wxPanel that contains all your widgets (you should have one) with ->Destroy(), and then create a new one. That should be straightforward
"Keyboard not detected. Press F1 to continue"
-- Windows

Post Reply