ok, now I think I've got something that works. Previous attempt registered double key presses in certain controls.
--------------------------Replacement function sendEvent in utils.mm---------------------------------
else if ([anEvent type] == NSKeyDown && ([anEvent modifierFlags] & NSCommandKeyMask))
--------------------------Replacement function wxWidgetCocoaImpl::keyEvent in window.mm---------------------------------
void wxWidgetCocoaImpl::keyEvent(WX_NSEvent event, WXWidget slf, void *_cmd)
{
wxLogTrace(TRACE_KEYS, "Got %s for %s",
wxDumpSelector((SEL)_cmd), wxDumpNSView(slf));
if ( !m_wxPeer->IsEnabled() )
return;
bool bTryPopagateToMenu = false;
if ( [event type] == NSKeyDown )
{
bTryPopagateToMenu = true;
BeginNativeKeyDownEvent(event);
}
bool bEventHandled = true;//false;
if ( GetFocusedViewInWindow([slf window]) != slf || m_hasEditor || (bEventHandled = !DoHandleKeyEvent(event)) )
{
wxOSX_EventHandlerPtr superimpl = (wxOSX_EventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
superimpl(slf, (SEL)_cmd, event);
}
if ( [event type] == NSKeyDown )
{
EndNativeKeyDownEvent();
}
if (bTryPopagateToMenu == true && bEventHandled == false)
{
if ( [[[NSApplication sharedApplication] mainMenu] performKeyEquivalent:event] )
{
wxLogTrace(TRACE_KEYS, "%s processed as key equivalent by the menu",
wxDumpSelector((SEL)_cmd));
return;
}
}
}