Consuming Modifier Keys in PluginEditor Window

I am playing with modifierKeysChanged() method in my PluginEditor, and I am trying to make the PluginEditor component consume all modifier keys when the plugin is in focus. This works when the mouse is over an area not occupied by a sub-component such as a slider. But when the mouse is over a slider, the slider consumes the modifier key (reasonable behavior to be sure!)

What would be the appropriate way to set the PluginEditor component to consume any modifier keys, even when the mouse is over a component within the PluginEditor?

I’ve tried to use the setWantsKeyboardFocus() method (false for slider, true for editor component), but haven’t had luck – would very much appreciate a nudge in the right direction. Thanks!

Unfortunately modifier key handing and plug-in GUIs are difficult to reconcile. A search of the forum will show that hosts do all kinds of monkeying about with specific key presses.

What plug-in format are you testing with? What operating system?

Yes – it was proving difficult to find a consensus of what behavior to expect.

I’m testing with AU in Logic on Monterey (everything latest version).

I was able to find a workaround by:

  1. Deriving a custom class from Slider,
    and then
  2. Overriding the custom slider’s modifierKeysChanged() method to call the Editor’s modifierKeysChanged() → basically catching the key change while the mouse is over the slider and passing it off.

This worked in Logic/AU.

1 Like