Keyboard commands

Hello everyone,

I am trying to alter the value of a specific slider when a directional button is pressed. For example, if the down arrow is pressed, the slider value will decrease by a value of 100. However, the timer is throwing an error: “Timer has no member named AsyncKeyDown”

I’m probably misreading / misunderstanding the example code from the documentation. Could someone provide some insight?


Do that in the Window’s KeyDown Event (you will add first), not in the Timer.

I think you want Keyboard.AsyncKeyDown.

@Emile Schwarz & @Kem Tekinay Thank you both! I’ve added Keyboard.AsyncKeyDown as an event handler, and it works. However, now I need to find a way to disable any other sliders from being affected by the use of arrow keys.

Return True i the Event…

Thanks @Emile Schwarz. That did the trick. I really need to do some serious reading. I’d prefer to understand what I’m doing and why :stuck_out_tongue:

Uh ? AsyncKeyDown is not an event, it is a property.

@Michel Bujardet

  • I have added Keyboard.AsyncKeyDown to the KeyDown Event

You don’t need to (nor should you) use the Async variant in a KeyDown event. You are passed the Key that was pressed as an argument. Use that. For reference

if Key = chr(28) then
    // Left Arrow
ElseIf Key = chr(29) then
   // Right Arrow
Elseif Key = chr(30) then
   // Up Arrow
ElseIf Key = chr(31) then
   // Down Arrow

Thanks @Tim Hare. I’ll give this a shot! I won’t be able to test this until tomorrow though.

I’d use “SELECT CASE” instead of IF/ELSEIF … would get cumbersome if you added a few more key conditions.