Hi David,

    This is for the key down and key up process. Note that you want the key up 
process if you want to capture info, for key down has little to offer, but you 
could do the silence there if you want, but queue it so events are happy...
        Bruce

'Global Vars:
Dim TV_KeyDown, TV_MouseDown, TV_Changing
TV_KeyDown = False: TV_MouseDown = False: TV_Changing = False

'Inside dialog function:
 If dEvent = treeviewKeyDown Then
'standard keys.
  TV_KeyDown = True
  myTV_KeyConnection = ConnectEvent( Keyboard, "OnKeyProcessedUp", 
"OnKeyProcessedUp")
 End If
 If dEvent = treeviewClicked Then
'Mouse buttons.
  TV_MouseDown = True
  myTV_MouseConnection = ConnectEvent( Mouse, "OnButtonUp", "OnButtonUp")
 End If

'Procedure Calls From Above:
Sub OnKeyProcessedUp( ky, md)
'Passing in key and multi keys.
 Disconnect myTV_KeyConnection
 myTV_KeyConnection = 0
 If TV_KeyDown and ky = vk_Space and md = 0 Then
  Silence
  Queue "LaunchAnyProcedure"
 End If
 TV_KeyDown = False
End Sub

Sub OnButtonUp( button)
'Passing in the button number.
 Disconnect myTV_MouseConnection
 myTV_MouseConnection = 0
 If TV_MouseDown and button = 0 Then
  Queue "LaunchAnyProcedure"
 End If
 TV_MouseDown = False
End Sub


Sent: Saturday, March 28, 2015 9:29 AM
Subject: Acting on certain keystrokes


For the illustrative purpose, let's say I need my app to act upon 
certain keystrokes, for instance silencing speech output whenever the 
defined keys are being pressed. Could anyone with experience, please, 
point me in some direction, or even provide a few lines of sample coding?

I have been reading a bit in the Reference manual, but am afraid it did 
not make too much sense to me, for whatever reason. Pretty sure, first I 
get the grasp of it, this might be a somehow trivial matter of coding, 
but that is just not kicking in today. Smiles.

OK, so let's say, I want to silence the speech, with the SILENCE 
command. This should be done, whenever the user hits the CTRL-key, or 
the Down-Arrow key. No other keystrokes. Well, remember this is the 
definitions for illustrative purposes, so the end app might have more 
sofisticated sets of keys, but I just wanted some samples to show the 
difference in operating with different kinds of keystrokes.

OK, I do know of the Silence command, and my guess is, that I somehow 
need to hook onto the KeyUp or KeyDown events. Or, is there any other 
events or commands needed for this kind of process. In case this is what 
I need, which of the two aforementioned events should I preferably be 
hooking onto, and what might be some of the pitfalls to look out for and 
error causioning? Also, what would be the more exact command line to 
hook onto the event. Can I for instance send one command, holding a set 
of specific keys, (like the Ctrl-key on its own, or, alternatively the 
Down-Arrow key on its own), or will I have to deal with this in two 
separate command lines? And, Is it at all possible to hook on to a 
modifier keystroke on its own, like the ctrl without any other keys 
pressed - or, will the interface only accept a fully qualified keystroke 
like Ctrl-A?

Any ideas, feedback and experiences in this landscape, will be greatly 
appreciated. Thanks,

-- 
David

_______________________________________________
Any views or opinions presented in this email are solely those of the author 
and do not necessarily represent those of Ai Squared.

For membership options, visit 
http://lists.window-eyes.com/options.cgi/scripting-window-eyes.com/lab4me%40fltg.net.
For subscription options, visit 
http://lists.window-eyes.com/listinfo.cgi/scripting-window-eyes.com
List archives can be found at 
http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com

---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

_______________________________________________
Any views or opinions presented in this email are solely those of the author 
and do not necessarily represent those of Ai Squared.

For membership options, visit 
http://lists.window-eyes.com/options.cgi/scripting-window-eyes.com/archive%40mail-archive.com.
For subscription options, visit 
http://lists.window-eyes.com/listinfo.cgi/scripting-window-eyes.com
List archives can be found at 
http://lists.window-eyes.com/private.cgi/scripting-window-eyes.com

Reply via email to