+void MyMiniFrame::OnReparent(wxCommandEvent& WXUNUSED(event))
+{
+ button->Reparent( main_frame );
+}
+
+// MyMainFrame
+
+BEGIN_EVENT_TABLE(MyMainFrame, wxFrame)
+ EVT_CLOSE ( MyMainFrame::OnCloseWindow)
+ EVT_BUTTON (ID_REPARENT, MyMainFrame::OnReparent)
+ EVT_MENU (wxID_PRINT, MyMainFrame::OnReparent)
+END_EVENT_TABLE()
+
+MyMainFrame::MyMainFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos,
+ const wxSize& size ) :
+ wxFrame(parent, id, title, pos, size )
+{
+}
+
+void MyMainFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
+{
+ Destroy();
+}
+
+void MyMainFrame::OnReparent(wxCommandEvent& WXUNUSED(event))
+{
+ // practical jokers might find satisfaction in reparenting the button
+ // after closing the mini_frame. We'll have the last laugh.
+ if (! mini_frame_exists)
+ wxMessageBox("The miniframe no longer exists.\n"
+ "You don't want to make this button an orphan, do you?",
+ "You got to be kidding");
+ else
+ button->Reparent( mini_frame );
+}
+
+