diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index ec32b8be4d..a9fed0b0a1 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -302,8 +302,9 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil; // programmatically. if ( !wxMacEditHelper::IsCurrentEditor(self) ) { + NSString *text = [str isKindOfClass:[NSAttributedString class]] ? [str string] : str; wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( (WXWidget) [self delegate] ); - if ( impl && lastKeyDownEvent && impl->DoHandleCharEvent(lastKeyDownEvent, str) ) + if ( impl && lastKeyDownEvent && impl->DoHandleCharEvent(lastKeyDownEvent, text) ) return; }