X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b4da152ea3ec3968fb2f304b6ed73e0279c19506..ac4eaadf8066e4810b849a9fcb17b1e17adea1af:/src/msw/textctrl.cpp diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index ecc2831ac1..53f74e07fd 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -5,8 +5,8 @@ // Modified by: // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -57,7 +57,11 @@ #include #include -#if wxUSE_RICHEDIT && (!defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__)) +#if wxUSE_RICHEDIT + +// old mingw32 has richedit stuff directly in windows.h and doesn't have +// richedit.h at all +#if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__) #include #endif @@ -98,9 +102,11 @@ // Watcom C++ doesn't define this #ifndef SCF_ALL -#define SCF_ALL 0x0004 + #define SCF_ALL 0x0004 #endif +#endif // wxUSE_RICHEDIT + // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- @@ -651,11 +657,13 @@ bool wxTextCtrl::StreamIn(const wxString& value, m_suppressNextUpdate = TRUE; } - if ( !::SendMessage(GetHwnd(), EM_STREAMIN, - SF_TEXT | - SF_UNICODE | - (selectionOnly ? SFF_SELECTION : 0), - (LPARAM)&eds) || eds.dwError ) + ::SendMessage(GetHwnd(), EM_STREAMIN, + SF_TEXT | + SF_UNICODE | + (selectionOnly ? SFF_SELECTION : 0), + (LPARAM)&eds); + + if ( eds.dwError ) { wxLogLastError(_T("EM_STREAMIN")); } @@ -906,6 +914,14 @@ void wxTextCtrl::SetInsertionPoint(long pos) void wxTextCtrl::SetInsertionPointEnd() { + // we must not do anything if the caret is already there because calling + // SetInsertionPoint() thaws the controls if Freeze() had been called even + // if it doesn't actually move the caret anywhere and so the simple fact of + // doing it results in horrible flicker when appending big amounts of text + // to the control in a few chunks (see DoAddText() test in the text sample) + if ( GetInsertionPoint() == GetLastPosition() ) + return; + long pos; #if wxUSE_RICHEDIT @@ -1347,7 +1363,7 @@ bool wxTextCtrl::MSWShouldPreProcessMessage(WXMSG* pMsg) void wxTextCtrl::OnChar(wxKeyEvent& event) { - switch ( event.KeyCode() ) + switch ( event.GetKeyCode() ) { case WXK_RETURN: if ( !(m_windowStyle & wxTE_MULTILINE) )