]> git.saurik.com Git - wxWidgets.git/commitdiff
Patches-1940222 ] wxTextCtrl and keydown on fully selected text (wxMac)
authorRobert Roebling <robert@roebling.de>
Thu, 17 Apr 2008 15:19:15 +0000 (15:19 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 17 Apr 2008 15:19:15 +0000 (15:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53246 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/textctrl.cpp

index 44ec53aa9a5739672493b5325a7fe6e057756e8c..6aac442420314221f6fdb3b41583e0a4e894de5e 100644 (file)
@@ -828,6 +828,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
 {
     int key = event.GetKeyCode() ;
     bool eat_key = false ;
+    long from, to;
 
     if ( key == 'a' && event.MetaDown() )
     {
@@ -855,10 +856,11 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
 
     // Check if we have reached the max # of chars (if it is set), but still
     // allow navigation and deletion
+    GetSelection( &from, &to );
     if ( !IsMultiLine() && m_maxLength && GetValue().length() >= m_maxLength &&
         key != WXK_LEFT && key != WXK_RIGHT && key != WXK_TAB &&
-        key != WXK_BACK && !( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) )
-       )
+        key != WXK_BACK && key != WXK_DELETE && !( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) &&
+        from == to )
     {
         // eat it, we don't want to add more than allowed # of characters