FlushKeys
FlushKeys
 
Parameters: NONE
Returns: NONE
 

      The FlushKeys command, clears the keyboard input que. This can be used to ensure the user doesn't hold the keys down for example.


FACTS:


      * None



Mini Tutorial:


      This examble reads the current scancode from the keyboard, if a key is pressed a message is displayed and then FlushKeys is executed. So it will not allow the key to be held down.


  
  
; Set the Demo to run at 20 frames per second or less
  SetFPS 20
  
; Start an infinite D0-LOOp
  Do
     
   ; Clear the screen to black RGB(0,0,0)
     Cls RGB(0,0,0)
     
   ; Read current Keyboard scancode
     CurrentKeyState=ScanCode()
     
   ; Display this button state to the screen.
     Print "Current Key pressed:"+     Str$( CurrentKeyState)
     
     
   ; If any keys were pressed, then flush all keyboard input events
     If CurrentKeyState<>0
        Print "A Key was Pressed"
        
      ; Clear the keyboard input que
        FlushKeys
     EndIf
     
     
   ; Display the screen
     Sync
     
   ; Loop back to the DO statement
  Loop
  
  
  
  




 
Related Info: FlushMouse | LeftMouseButton | MidMouseButton | MouseButton | RightMouseButton :
 


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