Is there a way to not destruct child of dialog for wxwidget

I have a dialog which is populated with auinotebook tab panels but every time I close the dialog it will destruct my tabs, however I want to know if there is a way I can keep the tabs in memory for the next time I create the dialog fresh. I don't want to cache dialog, but just the tabs.

I create dialog on the stack so it will call destructor when I close it, but i create tabs on the heap and have a map to keep the address of tabs, but they are allocated since the children of dialog are destroyed.

Any ideas if this is even possible? If so any hints how to do it?


You can't keep children of a window alive when the window itself is destroyed, so you either need to keep the entire dialog around (typically by hiding it, as advised by @ravenspoint), or reparent the tabs under some other window and then reparent them back under the dialog when it's recreated. But it's not really clear what advantage does the latter have compared to the former, so I'd just keep the dialog.

Another useful trick which could be relevant is to construct the tabs on demand only, i.e. initially construct only the first tab and create the other ones only when they're about to be shown. IME creating a single tab should be fast enough even if creating all of them takes too long.

Need Your Help

Video recording not working after switching camera using AVFoundation in iOS

ios avfoundation avcapturesession video-recording

I am recording the video in my app using AVFoundation. Recording works correctly if I don't switch the camera. As soon as I switch the camera , recording stop working. After debugging I found that in