]> git.saurik.com Git - wxWidgets.git/commitdiff
routing the tab, return events for single line fields back to standard wx handler...
authorStefan Csomor <csomor@advancedconcepts.ch>
Sat, 6 Nov 2010 15:48:48 +0000 (15:48 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sat, 6 Nov 2010 15:48:48 +0000 (15:48 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/textctrl.mm

index ad726edddf952bdcfb9f6597b41e018ff6a15867..6106bedc702ff6c885de5bf3b81ed5278c548fbd 100644 (file)
@@ -253,6 +253,42 @@ protected :
         impl->controlTextDidChange();
 }
 
         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);
 - (void)controlTextDidEndEditing:(NSNotification *)aNotification
 {
     wxUnusedVar(aNotification);