Page 1 of 1

Console RawKey not work on Linux and macOS

Posted: Sun Dec 18, 2022 1:07 pm
by mk-soft
RawKey get always result code 27 ...

OS: macOS Ventura; Linux Ubuntu 18.04 / 20.04 / 22.04; Mint Linux LMDE 5

Code: Select all

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

CallDebugger
P.S.
The error is older (PB v5.73) and unfortunately no one has tested it.