Hello,
I'm trying to create a two-stage or double-stroke hotkey, e.g.
Insert-x followed by a series of options offered by keys 1 to
9. Here's a rough idea of how I am going about it in code at the moment:
// start JS code
0: var conHandle = null;
1:
2 function test ( ) {
3 conHandle = ConnectEvent (Keyboard, "OnKeyDown", "OnKeyDown" )
4 }
5
6 function OnKeyDown (key, mod) {
7 if ( key == vk_1 ) {
8 Speak ("done");
9 Disconnect( conHandle );
10
11 return kdDiscard;
12 }
13 }
// end js code
A variant of this code runs as intended, even though the call to
disconnect (at line 9) comes before the callback returns its
disposition, and I would have thought that disconnecting the
connecting event at that point would disrupt the returning of the key
disposition. I would like to know exactly what goes on behind the
scenes when a callback tied to an event of this kind is invoked. More
specifically, where does the key disposition value returned by the
callback end up, and what happens (at least in theory) when the
disconnect method is invoked before the callback has completed execution?
If anyone has a more elegant solution to my original idea I would be
grateful for any pointers.
Regards
Matt