- wxActivateEvent event( wxEVT_ACTIVATE, TRUE, child->GetId() );
- event.SetEventObject( child);
- child->GetEventHandler()->ProcessEvent( event );
+ // send activate event to new child
+
+ wxMDIClientWindow *client_window = parent->GetClientWindow();
+ if (!client_window)
+ return;
+
+ child = (wxMDIChildFrame*) NULL;
+
+ wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
+ while (node)
+ {
+ wxMDIChildFrame *child_frame = wxDynamicCast( node->GetData(), wxMDIChildFrame );
+ // CE: we come here in the destructor with a null child_frame - I think because
+ // g_signal_connect (m_widget, "switch_page", (see below)
+ // isn't deleted early enough
+ if (!child_frame)
+ return ;
+
+ 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 );
+}