MidiKeyboardComponent setWantsKeyboardFocus(false) not working


#1

I have a MidiKeyboardComponent on my plugin and i cant disable the computer keyboard input for it. As soon as the plugin has the focus it plays when pressing one of my laptop keys. Even with setWantsKeyboardFocus(false). The documentation says that this option should disable any keyboard input. Any help welcome!

I also want to enable and disable the keyboard input while the plugin is running.


#2

i recently discovered that my au3 standalone does not trigger anymore the midi keyboard when pressing keys on the keyboard. but it works well as a plugin (any flavour). need to spend some hours of my freetime to investigate this again


#3

@patrickkunz Try calling setMouseClickGrabsKeyboardFocus (false) on your MidiKeyboardComponent so that it doesn’t grab the keyboard focus when the user clicks on it.

@kraken Does it work if you click on the MidiKeyboardComponent before pressing keys or is it just not getting any keyboard events at all? I’ve tried to replicate this with the AUv3Synth example but it seems to work OK.


#4

Thank for that. setMouseClickGrabsKeyboardFocus (false) sounded promising, but it did not help at least on OSX with the AU (64bit). I’m stuck here. I know that the problem maybe disappears when i set global PluginWantsKeyboardFocus to false, but i need the focus for other things.
I noticed the the keyboard start to work when i click somewhere into the plugin UI. …and i see no MidiKeyboardComponent methods that i can overwrite and hook in to add a disable keyboard feature by my own.


#5

I see now how it works. It’s a bit confusing. I needed at least one other element that has setWantsKeyboardFocus(true) set. After that setMouseClickGrabsKeyboardFocus (false) seems to work.
…and the keyboard component looses it’s focus when another elements grabs the focus.


#6

edit : sorry, my bad, solution from patrick works fine. it’s just ableton live that use the computer keyboard as midi input by default :grimacing: