fix SetFocus() in wxDialog-derived class ctor (which used to be ignored); this replaces patch 769552
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23937 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -863,17 +863,22 @@ void wxTopLevelWindowMSW::OnActivate(wxActivateEvent& event)
|
|||||||
{
|
{
|
||||||
if ( event.GetActive() )
|
if ( event.GetActive() )
|
||||||
{
|
{
|
||||||
// restore focus to the child which was last focused
|
// restore focus to the child which was last focused unless we already
|
||||||
// wxLogTrace(_T("focus"), _T("wxTLW %08x activated."), (int) m_hWnd);
|
// have it
|
||||||
|
wxLogTrace(_T("focus"), _T("wxTLW %08x activated."), (int) m_hWnd);
|
||||||
|
|
||||||
wxWindow *parent = m_winLastFocused ? m_winLastFocused->GetParent()
|
wxWindow *winFocus = FindFocus();
|
||||||
: NULL;
|
if ( !winFocus || wxGetTopLevelParent(winFocus) != this )
|
||||||
if ( !parent )
|
|
||||||
{
|
{
|
||||||
parent = this;
|
wxWindow *parent = m_winLastFocused ? m_winLastFocused->GetParent()
|
||||||
}
|
: NULL;
|
||||||
|
if ( !parent )
|
||||||
|
{
|
||||||
|
parent = this;
|
||||||
|
}
|
||||||
|
|
||||||
wxSetFocusToChild(parent, &m_winLastFocused);
|
wxSetFocusToChild(parent, &m_winLastFocused);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else // deactivating
|
else // deactivating
|
||||||
{
|
{
|
||||||
@@ -884,23 +889,12 @@ void wxTopLevelWindowMSW::OnActivate(wxActivateEvent& event)
|
|||||||
{
|
{
|
||||||
// let it know that it doesn't have focus any more
|
// let it know that it doesn't have focus any more
|
||||||
m_winLastFocused->HandleKillFocus((WXHWND)NULL);
|
m_winLastFocused->HandleKillFocus((WXHWND)NULL);
|
||||||
}
|
|
||||||
|
|
||||||
// so we NULL it out if it's a child from some other frame
|
// and don't remember it if it's a child from some other frame
|
||||||
wxWindow *win = m_winLastFocused;
|
if ( wxGetTopLevelParent(m_winLastFocused) != this )
|
||||||
while ( win )
|
|
||||||
{
|
|
||||||
if ( win->IsTopLevel() )
|
|
||||||
{
|
{
|
||||||
if ( win != this )
|
m_winLastFocused = NULL;
|
||||||
{
|
|
||||||
m_winLastFocused = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
win = win->GetParent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogTrace(_T("focus"),
|
wxLogTrace(_T("focus"),
|
||||||
|
Reference in New Issue
Block a user