RawKey() does always return 27 in console mode

Linux specific forum
Martin Verlaan
Enthusiast
Enthusiast
Posts: 135
Joined: Sun Apr 01, 2018 11:26 am
Location: Netherlands
Contact:

RawKey() does always return 27 in console mode

Post 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
User avatar
mk-soft
Always Here
Always Here
Posts: 6314
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

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

Post by mk-soft »

It as Bug.
RawKey not work on Linux and macOS

Bugreport: viewtopic.php?t=80297
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply