-wxMDIParentFrame::wxMDIParentFrame()
-{
- m_justInserted = FALSE;
- m_clientWindow = (wxMDIClientWindow *) NULL;
+ wxMDIChildFrame *child = parent->GetActiveChild();
+ if (child)
+ {
+ wxActivateEvent event1( wxEVT_ACTIVATE, false, child->GetId() );
+ event1.SetEventObject( child);
+ child->GetEventHandler()->ProcessEvent( event1 );
+ }
+
+ // send activate event to new child
+
+ wxMDIClientWindow *client_window = parent->GetClientWindow();
+ if (!client_window)
+ return;
+
+ child = (wxMDIChildFrame*) NULL;
+
+ wxWindowList::Node *node = client_window->GetChildren().GetFirst();
+ while (node)
+ {
+ wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
+
+ wxASSERT_MSG( child_frame, _T("child is not a wxMDIChildFrame") );
+
+ if (child_frame->m_page == page)
+ {
+ child = child_frame;
+ break;
+ }
+ node = node->GetNext();
+ }
+
+ if (!child)
+ return;
+
+ wxActivateEvent event2( wxEVT_ACTIVATE, true, child->GetId() );
+ event2.SetEventObject( child);
+ child->GetEventHandler()->ProcessEvent( event2 );