X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/da8eb5f5bbf9b3eaf6e5cd48ac16484b1c787846..f86a4930f2c69058684496a1882343fe8e709bf2:/src/osx/textentry_osx.cpp diff --git a/src/osx/textentry_osx.cpp b/src/osx/textentry_osx.cpp index d7175f8238..c5f53512b2 100644 --- a/src/osx/textentry_osx.cpp +++ b/src/osx/textentry_osx.cpp @@ -77,6 +77,8 @@ void wxTextEntry::GetSelection(long* from, long* to) const void wxTextEntry::SetMaxLength(unsigned long len) { + if ( GetTextPeer()->CanClipMaxLength() ) + GetTextPeer()->SetMaxLength(len); m_maxLength = len ; } @@ -222,6 +224,23 @@ bool wxTextEntry::IsEditable() const return m_editable ; } +bool wxTextEntry::SendMaxLenEvent() +{ + wxWindow *win = GetEditableWindow(); + wxCHECK_MSG( win, false, "can't send an event without a window" ); + + wxCommandEvent event(wxEVT_TEXT_MAXLEN, win->GetId()); + + // do not do this as it could be very inefficient if the text control + // contains a lot of text and we're not using ref-counted wxString + // implementation -- instead, event.GetString() will query the control for + // its current text if needed + //event.SetString(win->GetValue()); + + event.SetEventObject(win); + return win->HandleWindowEvent(event); +} + // ---------------------------------------------------------------------------- // Undo/redo // ----------------------------------------------------------------------------