X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e17d84e1b2189d11891d41b3809903eb22d1b91d..7c60222510bc5e197b12f153c4bf05db66cb0f4a:/src/osx/cocoa/textctrl.mm diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index 760257f4f4..14f3a176e1 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -111,6 +111,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; @interface wxMaximumLengthFormatter : NSFormatter { int maxLength; + wxTextEntry* field; } @end @@ -148,12 +149,17 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; int len = [*partialStringPtr length]; if ( maxLength > 0 && len > maxLength ) { - // TODO wxEVT_TEXT_MAXLEN + field->SendMaxLenEvent(); return NO; } return YES; } +- (void) setTextEntry:(wxTextEntry*) tf +{ + field = tf; +} + @end @implementation wxNSSecureTextField @@ -805,6 +811,7 @@ void wxNSTextFieldControl::SetMaxLength(unsigned long len) { wxMaximumLengthFormatter* formatter = [[[wxMaximumLengthFormatter alloc] init] autorelease]; [formatter setMaxLength:len]; + [formatter setTextEntry:GetTextEntry()]; [m_textField setFormatter:formatter]; }