Search code examples
c++wxwidgets

How to Reparent the panel when close the frame


I am creating a GUI which have a main window, which is wxFrame, on the main window there has a button. In the main window class, I have members which is a wxMiniFrame, and a wxPanel.

The scenario is when I click the button a new wxMiniFrame will be create and the Panel will be reparent to the wxMiniFrame, when the mini Frame is closed, I want the wxPanel to be reparent to the main window.

Is there any method to detect the miniframe is closed so that I can reparent the Panel?

Thanks in advance!


Solution

  • Handling the usual wxEVT_CLOSE_WINDOW should work fine for mini frames too.

    In any case, you can always do it from your wxMiniFrame-derived class dtor.