Esckey
State = Esckey()
 
Parameters: NONE
Returns:

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

      The EscKey() function with return the state of ESC key on your keyboard.

      Since ESC is Play Basic's built in break key, in order to be able to read ESC from with a program, you will need to disable this behaviour with the BreakKey command. Once disabled, you'll be able to read thje ESC key yourself.

      If the Esc key is being pressed, the function will return a value of 1 (True), or False (zero) if it's not being pressed.



FACTS:


      * None





Mini Tutorial:


      This example lets the user toggle the BreakKey control on/off while the program is running. You should notice that when BreakKey is off, hitting the ESC key has no effect upon the running program. While hitting ESC while Break is ON, will quit the program as normal.


  
  
; ==================
; BreakKey Example
; ==================
  
  Do
     
     Cls RGB(0,0,0)
     
     If GetBreakKey()=on
        s$="ON  - pressing ESC key will quit this program"
     Else
        s$="OFF - Pressing ESC has no effect"
     EndIf
     
     cx=GetScreenWidth()/2
     cy=(GetScreenHeight()/2)-20
     
     CenterText cx,cy,"Break Key Current Status:"+s$
     CenterText cx,cy+30,"Press Enter To Change BreakKey Status"
     
     
     If EnterKey() Then BreakKey 1-GetBreakKey()
     Sync
  Loop
  





 
Related Info: AltKeys | BreakKey | CtrlKeys | Downkey | EnterKey | FlushKeys | FunctionKeys | KeyState | Leftkey | Rightkey | Scancode | ShiftKeys | Upkey | WindowsKeys :
 


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