]> git.saurik.com Git - wxWidgets.git/commitdiff
bug fix for using multiline string (i.e. with embedded '\n's) in wxTextCtrl ctor
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 11 Nov 2001 19:27:35 +0000 (19:27 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 11 Nov 2001 19:27:35 +0000 (19:27 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12380 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/textctrl.cpp

index 4fdcde3e8332d4c46197c3a7e693c8ba193b4e82..bc78ce19b0386d5c5629d8c9496fd72ca0cc097f 100644 (file)
@@ -297,7 +297,18 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
         m_isRich = FALSE;
 #endif // wxUSE_RICHEDIT
 
-    if ( !MSWCreateControl(windowClass, msStyle, pos, size, value) )
+    // we need to turn '\n's into "\r\n"s for the multiline controls
+    wxString valueWin;
+    if ( m_windowStyle & wxTE_MULTILINE )
+    {
+        valueWin = wxTextFile::Translate(value, wxTextFileType_Dos);
+    }
+    else // single line
+    {
+        valueWin = value;
+    }
+
+    if ( !MSWCreateControl(windowClass, msStyle, pos, size, valueWin) )
         return FALSE;
 
     SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));