]> git.saurik.com Git - wxWidgets.git/commitdiff
implement EVT_TEXT and EVT_TEXT_ENTER for NSTextView-derived text controls.
authorKevin Ollivier <kevino@theolliviers.com>
Sat, 14 Mar 2009 19:39:30 +0000 (19:39 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Sat, 14 Mar 2009 19:39:30 +0000 (19:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59537 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/cocoa/textctrl.mm

index 208d4cebd018db9af83446c68b19f8234b5cfeec..fc2169099e6afa0ebdf4d8a0279ff42a26bb26c5 100644 (file)
 }
 
 
-- (void)controlTextDidChange:(NSNotification *)aNotification
+- (void)textDidChange:(NSNotification *)aNotification
 {
     if ( impl )
     {
         }
     }
 }
+
+- (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)commandSelector
+{
+    if ( impl  )
+    {
+        wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
+        if (commandSelector == @selector(insertNewline:))
+        {
+            if ( wxpeer && wxpeer->GetWindowStyle() & wxTE_PROCESS_ENTER ) 
+            {
+                wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, wxpeer->GetId());
+                event.SetEventObject( wxpeer );
+                event.SetString( static_cast<wxTextCtrl*>(wxpeer)->GetValue() );
+                wxpeer->HandleWindowEvent( event );
+            }
+        }
+    }
+    
+    return NO;
+}
 @end
 
 @implementation wxNSTextField