Hi, is there any mechanism to respond to changes in modifier keys being pressed (e.g. shift, ctrl), other than to poll?
thx
Hi, is there any mechanism to respond to changes in modifier keys being pressed (e.g. shift, ctrl), other than to poll?
thx
Component::modifierKeysChanged !
That doesn’t work on Windows and on OS X. On windows keyStateChanged is called but modifierKeysChanged isn’t. On OS X neither one is called.
Nevermind — Forgot to call setWantsKeyboardFocus.
Here’s the results with setWantsKeyboardFocus(true) called, for a component which was added to the desktop:
Windows: never, use keyStateChanged instead.
OS X: never
Linux / X11: usually, but not always
So the answer is: use polling.
–
Roeland
Not tried on Linux but OSX and Windows work fine for me…