]> git.saurik.com Git - wxWidgets.git/commitdiff
removing duplicated method, wiring native maxlength support, see #10269
authorStefan Csomor <csomor@advancedconcepts.ch>
Sun, 15 Jan 2012 15:54:53 +0000 (15:54 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sun, 15 Jan 2012 15:54:53 +0000 (15:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70355 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/osx/textctrl.h
src/osx/textctrl_osx.cpp

index 283a1694ea1643dad0c8fb92be2fcb220561ed7e..c983eee96457b37d3ee4e0623ff4a31488c9efb0 100644 (file)
@@ -75,10 +75,6 @@ public:
     virtual void MarkDirty();
     virtual void DiscardEdits();
 
-    // set the max number of characters which may be entered
-    // in a single line text control
-    virtual void SetMaxLength(unsigned long len);
-
     // set the grayed out hint text
     virtual bool SetHint(const wxString& hint);
     virtual wxString GetHint() const;
index a49ff2cfe209ea2e8613fa27a8c15f97655f9b7f..aa500bce448f77f7daf3aa43138059a092827627 100644 (file)
@@ -154,11 +154,6 @@ void wxTextCtrl::MacCheckSpelling(bool check)
     GetTextPeer()->CheckSpelling(check);
 }
 
-void wxTextCtrl::SetMaxLength(unsigned long len)
-{
-    m_maxLength = len ;
-}
-
 bool wxTextCtrl::SetFont( const wxFont& font )
 {
     if ( !wxTextCtrlBase::SetFont( font ) )
@@ -381,18 +376,21 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
         return ;
     }
 
-    // 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 &&
-        !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB | WXK_CATEGORY_CUT) &&
-        !( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) &&
-        from == to )
+    if ( !GetTextPeer()->CanClipMaxLength() )
     {
-        // eat it, we don't want to add more than allowed # of characters
+        // 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 &&
+            !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB | WXK_CATEGORY_CUT) &&
+            !( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) &&
+            from == to )
+        {
+            // eat it, we don't want to add more than allowed # of characters
 
-        // TODO: generate EVT_TEXT_MAXLEN()
-        return;
+            // TODO: generate EVT_TEXT_MAXLEN()
+            return;
+        }
     }
 
     // assume that any key not processed yet is going to modify the control