X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1d156af3247c862e51a7c62f569a3fd302052a42..49746f2306b6eb7ef1c53e63287b3de237ad719e:/src/msw/notebook.cpp diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index e69fd60c43..2a3a46fe78 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -144,6 +144,7 @@ void wxNotebook::Init() #if USE_NOTEBOOK_ANTIFLICKER m_hasSubclassedUpdown = false; + m_doneUpdateHack = false; #endif // USE_NOTEBOOK_ANTIFLICKER } @@ -411,7 +412,7 @@ bool wxNotebook::SetPageText(size_t nPage, const wxString& strText) TC_ITEM tcItem; tcItem.mask = TCIF_TEXT; - tcItem.pszText = (wxChar *)strText.wx_str(); + tcItem.pszText = wxMSW_CONV_LPTSTR(strText); if ( !HasFlag(wxNB_MULTILINE) ) return TabCtrl_SetItem(GetHwnd(), nPage, &tcItem) != 0; @@ -685,7 +686,7 @@ bool wxNotebook::InsertPage(size_t nPage, if ( !strText.empty() ) { tcItem.mask |= TCIF_TEXT; - tcItem.pszText = const_cast(strText.wx_str()); + tcItem.pszText = wxMSW_CONV_LPTSTR(strText); } // hide the page: unless it is selected, it shouldn't be shown (and if it @@ -978,6 +979,21 @@ void wxNotebook::OnSize(wxSizeEvent& event) } } } + + // Probably because of the games we play above to avoid flicker sometimes + // the text controls inside notebook pages are not shown correctly (they + // don't have their borders) when the notebook is shown for the first time. + // It's not really clear why does this happen and maybe the bug is in + // wxTextCtrl itself and not here but updating the page when it's about to + // be shown doesn't cost much and works around the problem so do it here + // for now. + if ( !m_doneUpdateHack && IsShownOnScreen() ) + { + m_doneUpdateHack = true; + wxWindow* const page = GetCurrentPage(); + if ( page ) + page->Update(); + } #endif // USE_NOTEBOOK_ANTIFLICKER event.Skip();