Page 1 of 1

RawKey() does always return 27 in console mode

Posted: Sun Dec 18, 2022 12:33 pm
by Martin Verlaan
I need RawKey for catching cursor keys, but it returns 27, is this a Linux problem?

I used the example below as test, and I am working in PopOs 22.04 LTS

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

Re: RawKey() does always return 27 in console mode

Posted: Sun Dec 18, 2022 1:08 pm
by mk-soft
It as Bug.
RawKey not work on Linux and macOS

Bugreport: viewtopic.php?t=80297