From b7a3ba7dcd3b2477a6383229159472b803742d7c Mon Sep 17 00:00:00 2001 From: Jamie Gadd Date: Thu, 19 Jan 2006 15:27:17 +0000 Subject: [PATCH] Fixed bug #778299 - wxTE_RICH2 causes SetValue to show control. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37000 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 2 ++ src/msw/textctrl.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 8617a58f4d..3eb8bb1ed2 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -75,6 +75,8 @@ wxMSW: - wxStatusBar no longer corrupts surrounding windows on resize. - Enable wxListCtrl in report mode to be able to use images in other columns, if ComCtl32 >= 470. +- Fixed problem where using SetValue and wxTE_RICH2 would cause control to + show. wxGTK: diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index a69a454363..0dd0da0b7b 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -1261,10 +1261,14 @@ void wxTextCtrl::DoSetSelection(long from, long to, bool scrollCaret) // ES_DISABLENOSCROLL // // this is very ugly but I don't see any other way to make this work + long style = 0; if ( GetRichVersion() > 1 ) { if ( !HasFlag(wxTE_NOHIDESEL) ) { + // setting ECO_NOHIDESEL also sets WS_VISIBLE and possibly + // others, remember the style so we can reset it later if needed + style = ::GetWindowLong(GetHwnd(), GWL_STYLE); ::SendMessage(GetHwnd(), EM_SETOPTIONS, ECOOP_OR, ECO_NOHIDESEL); } @@ -1280,6 +1284,8 @@ void wxTextCtrl::DoSetSelection(long from, long to, bool scrollCaret) { ::SendMessage(GetHwnd(), EM_SETOPTIONS, ECOOP_AND, ~ECO_NOHIDESEL); + if ( style != ::GetWindowLong(GetHwnd(), GWL_STYLE) ) + ::SetWindowLong(GetHwnd(), GWL_STYLE, style); } #endif // wxUSE_RICHEDIT } @@ -1963,7 +1969,7 @@ wxSize wxTextCtrl::DoGetBestSize() const int hText = cy; if ( m_windowStyle & wxTE_MULTILINE ) { - hText *= wxMax(wxMin(GetNumberOfLines(), 10), 2); + hText *= wxMax(wxMin(GetNumberOfLines(), 10), 2); } //else: for single line control everything is ok -- 2.45.2