inkey() doesn't return anything

Mac OSX specific forum
Poshu
Enthusiast
Enthusiast
Posts: 459
Joined: Tue Jan 25, 2005 7:01 pm
Location: Canada

inkey() doesn't return anything

Post by Poshu »

This code work on windows but does not return any value on osx (compile in console mode).

Code: Select all

OpenConsole("test")
EnableGraphicalConsole(#True)

Repeat
	Debug Inkey()
ForEver
Tested with 5.21 x64 and 5.22 x64 on an up-to-date maverick
Fred
Administrator
Administrator
Posts: 18220
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: inkey() doesn't return anything

Post by Fred »

Seems to be working in current release, can anybody else confirm ?
User avatar
mk-soft
Always Here
Always Here
Posts: 6245
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: inkey() doesn't return anything

Post by mk-soft »

Special key comes as esc sequence
Is that right?

Code: Select all

OpenConsole("test")
;EnableGraphicalConsole(#True)

Repeat
  k$ = Inkey()
  If k$
    If k$ = #ESC$
      c$ = ""
      Repeat
        k$ = Inkey()
        If k$ = ""
          Break
        Else
          c$ + Asc(k$) + " "
        EndIf
      ForEver
      Debug "ESC + " + c$
    Else
      Debug k$
    EndIf
  Else
    Delay(100)
  EndIf
ForEver
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
Fred
Administrator
Administrator
Posts: 18220
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: inkey() doesn't return anything

Post by Fred »

I think it should returns empty when non ascii key is pressed and RawKey() should be used. But for now, RawKey() doesn't catch any non ascii character except ESC. Could you try on Linux to see if it's the same behaviour or if it's OS X specific ?
User avatar
mk-soft
Always Here
Always Here
Posts: 6245
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: inkey() doesn't return anything

Post by mk-soft »

Fred wrote: Thu Nov 02, 2023 9:43 pm I think it should returns empty when non ascii key is pressed and RawKey() should be used. But for now, RawKey() doesn't catch any non ascii character except ESC. Could you try on Linux to see if it's the same behaviour or if it's OS X specific ?
OS: Mint Linux LMDE 6 and Raspberry x64

An ESC sequence for the special keys is also displayed under Linux. Partially up to 4 characters after ESC.
Under Raspberry unfortunately no terminal window with debug output starts and had to compile a program first

P.S
What does not work is to start purebasic-ide under SSH and Local at the same time. Just a tip
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
Fred
Administrator
Administrator
Posts: 18220
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: inkey() doesn't return anything

Post by Fred »

According to https://stackoverflow.com/questions/153 ... th-getchar we will need to use ncurse for this to work everywhere, which is a big dependency to add.
Post Reply