Key-holding question


#1

Hi all,

I need to implement key-holding, i.e. when someone presses a key in my app, I need to receive only one event, and then when he/she releases the key, I need to handle its release. JUCE behaves only in usual manner, sending multiple key events when I hold any key. Сan it somehow support key-holding itself or I need to make my own workaround for this? Thanks.


#2

Yes, just use keyStateChanged and check whether the keys you’re interested in are up or down with KeyPress::isKeyCurrentlyDown.