@interface wxMaximumLengthFormatter : NSFormatter
{
int maxLength;
+ wxTextEntry* field;
}
@end
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
if ( impl )
{
NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder();
- NSView* otherView = [responder isKindOfClass:[NSView class]] ? (NSView*)responder : nil;
+ NSView* otherView = wxOSXGetViewFromResponder(responder);
- wxWidgetImpl* otherWindow = impl->FindFromWXWidget(otherView);
+ wxWidgetImpl* otherWindow = impl->FindBestFromWXWidget(otherView);
impl->DoNotifyFocusEvent( false, otherWindow );
}
}
if ( impl )
{
NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder();
- NSView* otherView = [responder isKindOfClass:[NSView class]] ? (NSView*)responder : nil;
+ NSView* otherView = wxOSXGetViewFromResponder(responder);
- wxWidgetImpl* otherWindow = impl->FindFromWXWidget(otherView);
+ wxWidgetImpl* otherWindow = impl->FindBestFromWXWidget(otherView);
impl->DoNotifyFocusEvent( false, otherWindow );
}
}
}
NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder();
- NSView* otherView = [responder isKindOfClass:[NSView class]] ? (NSView*)responder : nil;
+ NSView* otherView = wxOSXGetViewFromResponder(responder);
- wxWidgetImpl* otherWindow = impl->FindFromWXWidget(otherView);
+ wxWidgetImpl* otherWindow = impl->FindBestFromWXWidget(otherView);
impl->DoNotifyFocusEvent( false, otherWindow );
}
}
{
wxMaximumLengthFormatter* formatter = [[[wxMaximumLengthFormatter alloc] init] autorelease];
[formatter setMaxLength:len];
+ [formatter setTextEntry:GetTextEntry()];
[m_textField setFormatter:formatter];
}