// override some more virtuals
virtual bool Show(bool show = TRUE);
- virtual void RemoveChild( wxWindowBase *child );
-
// event handlers
void OnActivate(wxActivateEvent& event);
void OnSysColourChanged(wxSysColourChangedEvent& event);
// current size - this has an effect of refreshing the window layout
void SendSizeEvent();
+ // called by wxWindow whenever it gets focus
+ void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
+ wxWindow *GetLastFocus() const { return m_winLastFocused; }
+
protected:
// common part of all ctors
void Init();
}
}
-void wxFrame::RemoveChild( wxWindowBase *child )
-{
- if ( child == m_winLastFocused )
- m_winLastFocused = NULL;
- wxFrameBase::RemoveChild(child);
-}
-
// ----------------------------------------------------------------------------
// tool/status bar stuff
// ----------------------------------------------------------------------------
m_isBeingDeleted = TRUE;
MSWDetachWindowMenu();
+
+ // VS: make sure there's no wxFrame with last focus set to us:
+ for (wxWindow *win = GetParent(); win; win = win->GetParent())
+ {
+ wxFrame *frame = wxDynamicCast(win, wxFrame);
+ if ( frame )
+ {
+ if ( frame->GetLastFocus() == this )
+ frame->SetLastFocus((wxWindow*)NULL);
+ break;
+ }
+ }
if ( m_parent )
m_parent->RemoveChild(this);