I have tis code in a timer with mode = 2 and period 125…
If Keyboard.AsyncKeyDown(123) then
//do something with the left arrow key
PreviousSlide
elseIf Keyboard.AsyncKeyDown(124) then
//do something with the right arrow key…
NextSlide
elseIf Keyboard.AsyncKeyDown(125) then
//do something with the down arrow key…
PreviousSlide
elseIf Keyboard.AsyncKeyDown(126) then
//do something with the Up arrow key…
NextSlide
end if
NextSlide and PreviousSlide are methods which will change the slide.
What I want to happen is that when an arrow key is pressed the appropriate method fires once only, what is happening is that the method fires multiple times depending on how long the arrow key is pressed.
Thanks, but I don’t seem to have it right. I have this code in the Keydown event and even the msgbox are not displaying…
SELECT CASE ASCB(key)
case 3,13
‘’’ do what ever the ENTER or RETURN key should do
case 9
‘’’ do what ever the TAB key should do
case 8
‘’’ handle a backspace
case 28
msgbox “28”
‘’’ handle back arrow
PreviousSlide
case 29
msgbox “29”
‘’’ handle right arrow
NextSlide
case 30
msgbox “30”
‘’’ handle up arrow
NextSlide
case 31
msgbox “31”
‘’’ handle down arrow
PreviousSlide
case else
return false ’ let OS handle the key, as it is not one you want to handle special
end select
return true ’ you handled the key… OS will ignore it now
Thanks, but I don’t seem to have it right. I have this code in the Keydown event and even the msgbox are not displaying…
SELECT CASE ASCB(key)
case 3,13
‘’’ do what ever the ENTER or RETURN key should do
case 9
‘’’ do what ever the TAB key should do
case 8
‘’’ handle a backspace
case 28
msgbox “28”
‘’’ handle back arrow
PreviousSlide
case 29
msgbox “29”
‘’’ handle right arrow
NextSlide
case 30
msgbox “30”
‘’’ handle up arrow
NextSlide
case 31
msgbox “31”
‘’’ handle down arrow
PreviousSlide
case else
return false ’ let OS handle the key, as it is not one you want to handle special
end select
return true ’ you handled the key… OS will ignore it now
any insights as to where I am going wrong?
Thanks.
Lennox[/quote]
Where are you getting your keydown ? Are you even sure it fires ? Keydown is tied to the control that has the focus. If that control does not have the focus, keydown does not fire.
You may want to add
System.DebugLog "Keydown"
at the beginning of your event. It will show “Keydown” in the IDE messages if and when the event fires.