I ran some tests with the newest version of X11-Basic. The following program tests keyboard input using INKEY$ or INP(-2) (use either the one or the other of the two lines).
repeat
'm$ = Inkey$ ! Use either this line or the following, but not both.
m$ = INP(-2) ! This should possibly be m$ = CHR$(INP(-2)), if INP() returns a number.
! Anyway, it did not work.
If m$<>""
Print "|";m$;"|"
Endif
pause 0.001 ! Release timeslice to OS
Until m$="a"
Print "Done."
End
The results:
INP() is not recognized by the Windows version nor by the Android version.
Both return an error: "Array not dimensioned: INP()". (The same happens when using ~INP().)
INKEY$ works as expected on Android: every time a key is pressed, it is printed on the screen (between | characters).
But in the Windows version, all the typed characters are immediately echoed on the screen (not because of the PRINT statement, but automatically by the interpreter). On the other hand, the result of INKEY$ remained empty until the "Enter" key was pressed. When pressing "Enter", INKEY$ returned only the first character of the current line; plus all the remaining characters of the previous line if there was one.
So for example, when I pressed the following key sequence (without the commas and spaces):
1, 2, 3, 4, Enter, a, b, c, Enter, Enter
... the screen output was:
1234
|1|
abc
|234
a|
|bc
|
(where the parts between | characters, i.e. the output of the PRINT statements, appeared after pressing "Enter".)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for mentioning it. There was a bug in the windows version. It used getc() instead of getch() which will cause no echo and it does not wait for a return. The next version will have that fixed.
BTW: INP(-2) returns a number and is suppoed to wait until a key is pressed (unlike INKEY$). It had the same problem with echoing and Return, but is now fixed as well.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I ran some tests with the newest version of X11-Basic. The following program tests keyboard input using INKEY$ or INP(-2) (use either the one or the other of the two lines).
The results:
INP() is not recognized by the Windows version nor by the Android version.
Both return an error: "Array not dimensioned: INP()". (The same happens when using ~INP().)
INKEY$ works as expected on Android: every time a key is pressed, it is printed on the screen (between | characters).
But in the Windows version, all the typed characters are immediately echoed on the screen (not because of the PRINT statement, but automatically by the interpreter). On the other hand, the result of INKEY$ remained empty until the "Enter" key was pressed. When pressing "Enter", INKEY$ returned only the first character of the current line; plus all the remaining characters of the previous line if there was one.
So for example, when I pressed the following key sequence (without the commas and spaces):
1, 2, 3, 4, Enter, a, b, c, Enter, Enter
... the screen output was:
(where the parts between | characters, i.e. the output of the PRINT statements, appeared after pressing "Enter".)
Thanks for mentioning it. There was a bug in the windows version. It used getc() instead of getch() which will cause no echo and it does not wait for a return. The next version will have that fixed.
BTW: INP(-2) returns a number and is suppoed to wait until a key is pressed (unlike INKEY$). It had the same problem with echoing and Return, but is now fixed as well.