App doesn't capture KeyCommands

I imagine it’s a real simple problem, but I can’t find the reason of the problem.
In my application I can’t capture KeyPress with no ModifierKeys associated. My mac rises the sound to alert me that those are blocked (but, for example, KeyPress::F9Key is captured)

I capture those in getCommandInfo and as I show in follow lines the second doesn’t works:

result.defaultKeypresses.add(KeyPress(KeyPress::F2Key, ModifierKeys::commandModifier, 0)); // this works
result.defaultKeypresses.add(KeyPress(KeyPress::F2Key, ModifierKeys::noModifiers, 0)); // this DOESN'T works
result.defaultKeypresses.add(KeyPress(KeyPress::F9Key, ModifierKeys::noModifiers, 0)); // this works

None? I’m trying to do an application that could not have any window on desktop sometimes

Is the system using the F2 key for something?

1 Like

yes… but I don’t think the problem is f2… that was an example, i stored a lot of commands, like also for example ‘a’ ‘e’ ‘2’ ecc…

Did you set setWantsKeyboardFocus(true);? You need this even for a ApplicationCommandTarget.

1 Like

Yes, I look around a lot… But every test done without a component fails… I’d like to capture the keyboard presses outside a component…

I’m not sure if this is possible. For component functionality you need a component.

1 Like

I’ll search deeply… I was trying to implement a sort of midi learn but for keyboard