X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce7fe42e848cc0c9058dae906c3a7bded50681e6..931d6a47c32a5b4c283243cb553ce71ee2b535d5:/src/aui/auibook.cpp diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index caa36cbb33..2d1787ee0a 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -423,7 +423,7 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) size_t button_count = m_buttons.GetCount(); // create off-screen bitmap - bmp.Create(m_rect.GetWidth(), m_rect.GetHeight()); + bmp.Create(m_rect.GetWidth(), m_rect.GetHeight(),*raw_dc); dc.SelectObject(bmp); if (!dc.IsOk()) @@ -2993,9 +2993,21 @@ void wxAuiNotebook::OnChildFocusNotebook(wxChildFocusEvent& evt) } - // change the tab selection to the child - // which was focused - int idx = m_tabs.GetIdxFromWindow(evt.GetWindow()); + // find the page containing the focused child + wxWindow* win = evt.GetWindow(); + while ( win ) + { + // pages have the notebook as the parent, so stop when we reach one + // (and also stop in the impossible case of no parent at all) + wxWindow* const parent = win->GetParent(); + if ( !parent || parent == this ) + break; + + win = parent; + } + + // change the tab selection to this page + int idx = m_tabs.GetIdxFromWindow(win); if (idx != -1 && idx != m_curPage) { SetSelection(idx);