Missing keyUp events on meaningful key combinations (e.g. “Select till beginning of line”)

后端 未结 3 498
面向向阳花
面向向阳花 2020-12-11 20:28

I have an NSTextField which uses as an extended NSTextFieldCell, which creates a custom field editor, that intercepts and records key events. (Knowing the key events is impo

3条回答
  •  被撕碎了的回忆
    2020-12-11 21:17

    For others, this is the code to "fix" it:

    - (void)sendEvent:(NSEvent *)event {
        if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask))
            [[self keyWindow] sendEvent:event];
        else
            [super sendEvent:event];
    }
    

提交回复
热议问题