yet another attempt to fix LastFocus bug in wxFrame
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10349 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -61,8 +61,6 @@ public:
|
|||||||
// override some more virtuals
|
// override some more virtuals
|
||||||
virtual bool Show(bool show = TRUE);
|
virtual bool Show(bool show = TRUE);
|
||||||
|
|
||||||
virtual void RemoveChild( wxWindowBase *child );
|
|
||||||
|
|
||||||
// event handlers
|
// event handlers
|
||||||
void OnActivate(wxActivateEvent& event);
|
void OnActivate(wxActivateEvent& event);
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
@@ -118,6 +116,10 @@ public:
|
|||||||
// current size - this has an effect of refreshing the window layout
|
// current size - this has an effect of refreshing the window layout
|
||||||
void SendSizeEvent();
|
void SendSizeEvent();
|
||||||
|
|
||||||
|
// called by wxWindow whenever it gets focus
|
||||||
|
void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
|
||||||
|
wxWindow *GetLastFocus() const { return m_winLastFocused; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
@@ -799,13 +799,6 @@ void wxFrame::OnActivate(wxActivateEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrame::RemoveChild( wxWindowBase *child )
|
|
||||||
{
|
|
||||||
if ( child == m_winLastFocused )
|
|
||||||
m_winLastFocused = NULL;
|
|
||||||
wxFrameBase::RemoveChild(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// tool/status bar stuff
|
// tool/status bar stuff
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -289,6 +289,18 @@ wxWindow::~wxWindow()
|
|||||||
|
|
||||||
MSWDetachWindowMenu();
|
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 )
|
if ( m_parent )
|
||||||
m_parent->RemoveChild(this);
|
m_parent->RemoveChild(this);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user