From: Stefan Csomor Date: Sat, 6 Nov 2010 15:48:48 +0000 (+0000) Subject: routing the tab, return events for single line fields back to standard wx handler... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/76b1a2c26eb9c45f10ed54213320c01ba32746ec?ds=inline routing the tab, return events for single line fields back to standard wx handler (doesn't work for secure fields unfortunately), fixes #12386 and partly #12392 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index ad726edddf..6106bedc70 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -253,6 +253,42 @@ protected : impl->controlTextDidChange(); } +- (BOOL)control:(NSControl*)control textView:(NSTextView*)textView doCommandBySelector:(SEL)commandSelector +{ + wxUnusedVar(textView); + wxUnusedVar(control); + + BOOL handled = NO; + + // send back key events wx' common code knows how to handle + + wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); + if ( impl ) + { + wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer(); + if ( wxpeer ) + { + if (commandSelector == @selector(insertNewline:)) + { + [textView insertNewlineIgnoringFieldEditor:self]; + handled = YES; + } + else if ( commandSelector == @selector(insertTab:)) + { + [textView insertTabIgnoringFieldEditor:self]; + handled = YES; + } + else if ( commandSelector == @selector(insertBacktab:)) + { + [textView insertTabIgnoringFieldEditor:self]; + handled = YES; + } + } + } + + return handled; +} + - (void)controlTextDidEndEditing:(NSNotification *)aNotification { wxUnusedVar(aNotification);