]> git.saurik.com Git - wxWidgets.git/commitdiff
Use white background by default for multiline readonly wxTextCtrl under MSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 7 Dec 2009 05:01:21 +0000 (05:01 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 7 Dec 2009 05:01:21 +0000 (05:01 +0000)
The best default behaviour seems to be to use white background for multiline
text controls even when they're read-only, as in previous wx versions.

Also see #11521 which could be implemented to make this configurable.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62804 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/text/text.cpp
src/msw/textctrl.cpp

index 3e1efc157f0e69809f708557ac4563284ddbf16d..575ac2b6f9cc718f2195d6e413a53ad34b440ae9 100644 (file)
@@ -1031,7 +1031,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
 #if wxUSE_LOG
     m_log = new wxTextCtrl( this, wxID_ANY, wxT("This is the log window.\n"),
                             wxPoint(5,260), wxSize(630,100),
-                            wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH);
+                            wxTE_MULTILINE | wxTE_READONLY);
 
     m_logOld = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
 #endif // wxUSE_LOG
index 4c910b173ecf7aee96cb28d52b08ebf19e03b072..8ffbfce0c1799c2cdf93365d1e8942f6541b10fb 100644 (file)
@@ -544,7 +544,20 @@ bool wxTextCtrl::MSWCreateText(const wxString& value,
 
         ::SendMessage(GetHwnd(), EM_SETEVENTMASK, 0, mask);
     }
+    else
 #endif // wxUSE_RICHEDIT
+    if ( HasFlag(wxTE_MULTILINE) && HasFlag(wxTE_READONLY) )
+    {
+        // non-rich read-only multiline controls have grey background by
+        // default under MSW but this is not always appropriate, so forcefully
+        // reset the background colour to normal default
+        //
+        // this is not ideal but, after a long discussion on wx-dev (see
+        // http://thread.gmane.org/gmane.comp.lib.wxwidgets.devel/116360/) it
+        // was finally deemed to be the best behaviour by default (and ideally
+        // we'd have a way to change this, see #11521)
+        SetBackgroundColour(GetClassDefaultAttributes().colBg);
+    }
 
 #ifndef __WXWINCE__
     // Without this, if we pass the size in the constructor and then don't change it,