Page 1 of 1
inkey() doesn't return anything
Posted: Fri Mar 21, 2014 7:13 pm
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
Re: inkey() doesn't return anything
Posted: Thu Nov 02, 2023 4:27 pm
by Fred
Seems to be working in current release, can anybody else confirm ?
Re: inkey() doesn't return anything
Posted: Thu Nov 02, 2023 6:41 pm
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
Re: inkey() doesn't return anything
Posted: Thu Nov 02, 2023 9:43 pm
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 ?
Re: inkey() doesn't return anything
Posted: Fri Nov 03, 2023 12:27 am
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
Re: inkey() doesn't return anything
Posted: Fri Nov 03, 2023 11:59 am
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.