First the background:
I am trying to create a front-end menu program, with the fancy effects and scrolling almost entirely composed in Quartz Composer. I am wrapping this composition in a widget so I can access it via the F12 key, use the keyboard to select something from my widget-quartz-menu, and then have the widget process the selection (i.e. launch a file).
I am using keyboard navigation in the widget-composition: the arrow keys will move the menu selection up and down, and a key press will select something. All of this is working in the Quartz Composer file. In the widget javascript, I added a keyboard handler for onkeyup. My idea is to simply test for which key is pressed, and perform some action if it is the correct key (the letter "a" for example).
Now the dilemma:
To test this functionality, I simply an alert to the key handler function. It looks like this:
When the widget first launches, I can see the keycodes for every key pressed - arrows, letters, etc. But I have to click in the widget to set its focus in order for the composition to see the keystrokes. After I click on the composition, only the arrow key presses get passed through to the javascript. Any letters I press, while they do register in the composition, are not seen myKeyUpHandler funtion. The arrows are seen.
Any thoughts or suggestions?
On a side note: I am working on a laptop and it has a function key (fn). If I hold the fn key while pressing a letter, it does seem to be seen by both the javascript handler and the quartz composition. And the keycode returned is the same whether or not the fn key is pressed. But I can't use this as a solution, since I will not have a fn key on the computer where this widget will be running.
Thanks.
I am trying to create a front-end menu program, with the fancy effects and scrolling almost entirely composed in Quartz Composer. I am wrapping this composition in a widget so I can access it via the F12 key, use the keyboard to select something from my widget-quartz-menu, and then have the widget process the selection (i.e. launch a file).
I am using keyboard navigation in the widget-composition: the arrow keys will move the menu selection up and down, and a key press will select something. All of this is working in the Quartz Composer file. In the widget javascript, I added a keyboard handler for onkeyup. My idea is to simply test for which key is pressed, and perform some action if it is the correct key (the letter "a" for example).
Now the dilemma:
To test this functionality, I simply an alert to the key handler function. It looks like this:
Code:
function myKeyUpHandler(event) {
alert(event.which);
}
Any thoughts or suggestions?
On a side note: I am working on a laptop and it has a function key (fn). If I hold the fn key while pressing a letter, it does seem to be seen by both the javascript handler and the quartz composition. And the keycode returned is the same whether or not the fn key is pressed. But I can't use this as a solution, since I will not have a fn key on the computer where this widget will be running.
Thanks.