window component input problem in macos program (xcode-objectivec++)

In my program, I overridden the NSTextField as follows:

@interface CustomTextField:NSTextField
@end

@implementation CustomTextField

- (BOOL)performKeyEquivalent:(NSEvent *)event 
{
    NSUInteger flags = [event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask;
    NSString *modifierFlagsString = @"";

    if ((flags & NSEventModifierFlagControl) != 0) 
    {
        modifierFlagsString = [modifierFlagsString stringByAppendingString:@"Control+"];
    }
    
    NSString *key = [[event charactersIgnoringModifiers] uppercaseString];
    NSString *hkString = [modifierFlagsString stringByAppendingString:key];

    self.stringValue = [NSString stringWithFormat:@"*%@", hkString];
    return YES;
}

In short, my goal is to capture the function key + key event when NSTextField is entered, and then display it in the specified format.

But if the key pressed does not contain a shortcut, I want no input. How can I achieve this? Because I tried keydown and other methods but none of them seemed correct.

window component input problem in macos program (xcode-objectivec++)
 
 
Q