KeyState
State = KeyState(ScanCodeValue)
 
Parameters:

    ScanCodeValue = The scan code value of the key you wish to check
Returns:

    State = The state of the key (0= up, 1 = pressed)
 

      The KeySate function returns the current state (pressed or not) of any key upon your keyboard.

      If the key is being pressed the KeyState will return a value of 1 (True) or zero is it's not.

      It's important to understand that KeyState uses the scan code key values and NOT an ASC II characters values.




FACTS:


      * Using KeyState you can detect when more than one key is being pressed. However most keyboards have limits on the number of keys that can simultaneously held down.

      * See KeyBoardState to return the state of all keys





Mini Tutorial:


      This example uses reads the state of a bunch of keys using KeyState.

  
  
  Do
     Cls RGB(0,0,0)
     
   ; Manually Check for some key states.
     Print "Enter State:"+Str$(KeyState(28))
     Print "Up Arrow:"+Str$(KeyState(200))
     Print "Down Arrow:"+Str$(KeyState(208))
     Print "A State:"+Str$(KeyState(30))
     Print "S State:"+Str$(KeyState(31))
     Print "D State:"+Str$(KeyState(32))
     Print "F State:"+Str$(KeyState(33))
     
     
   ; Display the Screen and loop back to do to continue the program.
     Sync
  Loop
  



 
Related Info: Inkey$ | Input | KeyBoardState | Scancode :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com