From: Kevin Ollivier Date: Sat, 14 Mar 2009 19:39:30 +0000 (+0000) Subject: implement EVT_TEXT and EVT_TEXT_ENTER for NSTextView-derived text controls. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/533e2ae1acecda012e931f6e4e9dc9bce8e65f5f implement EVT_TEXT and EVT_TEXT_ENTER for NSTextView-derived text controls. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59537 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index 208d4cebd0..fc2169099e 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -128,7 +128,7 @@ } -- (void)controlTextDidChange:(NSNotification *)aNotification +- (void)textDidChange:(NSNotification *)aNotification { if ( impl ) { @@ -141,6 +141,26 @@ } } } + +- (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(wxpeer)->GetValue() ); + wxpeer->HandleWindowEvent( event ); + } + } + } + + return NO; +} @end @implementation wxNSTextField