RawKey()

Syntax

Result = RawKey()
Description
Returns a the rawkey value of the last Inkey() command call. It's useful for extended (non-ASCII) keys (for example, function keys, arrows, etc).

Notes:
It is not only alphanumeric keys that have an ASCII value. The escape key (27), return key (10) tab key (9) and backspace key (8) are just four examples.

Example:
  If OpenConsole()
    PrintN("Press Escape to exit")
  
    Repeat
      KeyPressed$ = Inkey()
      
      If KeyPressed$ <> ""
        
        PrintN("You pressed: " + KeyPressed$)
        PrintN("It has a raw code of: "+Str(RawKey()))
        
      ElseIf RawKey()
      
        PrintN("You pressed a non ascii key.")
        PrintN("It has a raw code of: "+Str(RawKey()))
        
      Else
        Delay(20) ; Don't eat all the CPU time, we're on a multitask OS
      EndIf
    
    Until KeyPressed$ = Chr(27) ; Wait until escape is pressed
  EndIf

Supported OS

All

<- PrintN() - Console Index - ReadConsoleData() ->