I’m trying to use the Keyboard Intrinsic object . I keep getting “This item does not exist”. I’ve tried to put it in a timer and on the KeyPressed Event handler of my WebTextField. I’m sure this is simple, but searching around for a answer as to why it does not exist has eluded me.
Try this :
[code]Function KeyDown(Key As String) As Boolean
for i as integer = &h00 to &HFF
If Keyboard.AsynckeyDown(i) then
//do something with this key here
msgbox "key pressed: "+str(i)
end if
next
return true
End Function
[/code]
Although it auto-completes, it appears the Keyboard object is only available for desktop apps. I’ve updated the page in the Language Reference to make this clear.
In a web app, if you want to determine the key that was pressed used the Details parameter of the KeyPressed event handler.
Ahhhhh…I did wonder about that. I’m just working with Web Apps, not the desktop. The auto-complete is kind of deceiving when it really auto completes.
I did get the Keypressed event to work with the Details parameter, but it wasn’t trapping the TAB key very well. That’s when I stumbled onto the Keyboard object and thought I could trap it there.
I did a ExecuteJavascript workaround for now:
ExecuteJavaScript(" $(’#txtcc’).keydown(function(objEvent) { if (objEvent.keyCode == 9 || objEvent.keyCode == 13 || objEvent.keyCode==32) { objEvent.preventDefault(); } }) ; ")
Hey, thanks for the help and clarifications.