Hey guys,
I know that i can use event.shiftKey, event.ctrlKey, event.altKey and event.metaKey to check whether a certain modifier key is pressed or not. But these properties will return undefined if the keyIndentifier is for modifier key.
But what I want to do is only capture the modifier keys
For example,
var w = new Window("dialog","keyboard");
var textInput = w.add("edittext");
textInput.preferredSize = [100,30];
textInput.active = true;
textInput.addEventListener ("keydown", function (k){sayHi(k)});
function sayHi (k)
{
if (k.keyName == "Alt")
{
textInput.text = "Hello "
}
}
w.show();
I created a dialog with a edit text field, what I want to do is change the text to "Hello" when the "Alt" key is pressed, but my code doesn't work.
So, how can I only capture the modifier keys without need to press other keys or click the mouse at the same time?