The following code in PB6.20 allows you (using the arrow keys) to move the console's cursor inside the console window without filling it with garbage:
Code: Select all
EnableExplicit
#CONSOLE_CODE_CURSOR_UP = Chr(27) + "[1A"
#CONSOLE_CODE_CURSOR_DOWN = Chr(27) + "[1B"
#CONSOLE_CODE_CURSOR_RIGHT = Chr(27) + "[1C"
#CONSOLE_CODE_CURSOR_LEFT = Chr(27) + "[1D"
Define str_keypress.s = ""
Define int_keycode.i = 0
If OpenConsole()
Repeat
str_keypress = Inkey()
int_keycode = RawKey()
If int_keycode
Select int_keycode
Case 65
Print(#CONSOLE_CODE_CURSOR_UP)
Case 66
Print(#CONSOLE_CODE_CURSOR_DOWN)
Case 67
Print(#CONSOLE_CODE_CURSOR_RIGHT)
Case 68
Print(#CONSOLE_CODE_CURSOR_LEFT)
EndSelect
EndIf
Delay(10) ; Removing the delay reduces the problem but that's not a valid solution.
ForEver
EndIf
https://freeimage.host/i/FCSsXUu
This is in PB6.20 (correct)
https://freeimage.host/i/FCStx7n