From b1a14f6748ccacc9ca481a17f42f8ff33d894ac0 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sat, 31 Jul 2004 15:43:20 +0000 Subject: [PATCH] Fixed wxTextCtrl::SetMaxLength for rich edit controls git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@28565 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + docs/latex/wx/text.tex | 2 +- src/msw/textctrl.cpp | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 88695fde25..4b4fea7d1d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -216,6 +216,7 @@ wxMSW: - wxLongLong formatting with MinGW corrected - wxFileDialog now returns correct filter index for multiple-file dialogs - Fixed a bug in wxSpinCtrl::DoGetBestSize that would make wxSpinCtrl too tall +- Fixed wxTextCtrl::SetMaxLength for rich edit controls wxGTK: diff --git a/docs/latex/wx/text.tex b/docs/latex/wx/text.tex index 94f22b7d16..a213466d52 100644 --- a/docs/latex/wx/text.tex +++ b/docs/latex/wx/text.tex @@ -846,7 +846,7 @@ already is filled up to the maximal length, a (giving it the possibility to show an explanatory message, for example) and the extra input is discarded. -Note that this function may only be used with single line text controls. +Note that under GTK+, this function may only be used with single line text controls. \wxheading{Compatibility} diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index a0311a97ae..b6f3a8e588 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -1247,6 +1247,11 @@ wxString wxTextCtrl::GetLineText(long lineNo) const void wxTextCtrl::SetMaxLength(unsigned long len) { +#if wxUSE_RICHEDIT + if (IsRich()) + ::SendMessage(GetHwnd(), EM_EXLIMITTEXT, 0, (LPARAM) (DWORD) len); + else +#endif ::SendMessage(GetHwnd(), EM_LIMITTEXT, len, 0); }