Hello,
Recently, I needed to hold a key pressed, and only fire the up event when it truely finish it.
Actually it seems impossible, since the key repeat fires the both event continuously.
So, I just changed the cpp source to add the QT isAutoRepeat option.
Since I dont know really how the arguments are passed, I just overrided the ‘key’ flag, the last one in the key down callback, that I never use.
key - An Integer denoting a key, corresponding to the "Key" enum of the Qt C++ API. Comparing this value is the most reliable way to check which key was pressed. For a list of possible values, see: http://qt-project.org/doc/qt-4.8/qt.html#Key-enum.
What is the real use of this argument ? Considering how more crucial it could be to have a real key repeat information, should we not consider replace it ?
Or we could add it in the QWidget Proxy, but I don’t know how hard it could be ?
edit:
the result of the code below
(
View(nil, 200@200).front
.keyDownAction_{arg ...args;
"down".post;
args.postln;
}
.keyUpAction_{arg ...args;
"up".post;
args.postln;
}
)
is (the auto repeat is the last arg)
//first touch
down[ a View, d, 0, 100, 100, 0 ]
up[ a View, d, 0, 100, 100, 1 ]
down[ a View, d, 0, 100, 100, 1 ]
up[ a View, d, 0, 100, 100, 1 ]
down[ a View, d, 0, 100, 100, 1 ]
up[ a View, d, 0, 100, 100, 1 ]
down[ a View, d, 0, 100, 100, 1 ]
up[ a View, d, 0, 100, 100, 1 ]
down[ a View, d, 0, 100, 100, 1 ]
up[ a View, d, 0, 100, 100, 1 ]
down[ a View, d, 0, 100, 100, 1 ]
up[ a View, d, 0, 100, 100, 1 ]
down[ a View, d, 0, 100, 100, 1 ]
up[ a View, d, 0, 100, 100, 1 ]
down[ a View, d, 0, 100, 100, 1 ]
up[ a View, d, 0, 100, 100, 1 ]
down[ a View, d, 0, 100, 100, 1 ]
up[ a View, d, 0, 100, 100, 1 ]
down[ a View, d, 0, 100, 100, 1 ]
up[ a View, d, 0, 100, 100, 1 ]
down[ a View, d, 0, 100, 100, 1 ]
up[ a View, d, 0, 100, 100, 0 ]
//release