Some more some better:
Code: (Select All)
_Title "MyCurs Test use left and right arrow keys to move cursor" 'b+ 2023-01-24
Screen _NewImage(800, 600, 32)
cursCol = 1: cursRow = 1
text$ = "Hello World"
Do
Cls
Print text$
myCurs cursRow, cursCol
kh& = _KeyHit
If kh& = 19200 And cursCol > 1 Then
cursCol = cursCol - 1
ElseIf kh& = 19712 And cursCol < 100 Then
cursCol = cursCol + 1
ElseIf (kh& >= 32 And kh& <= 127) Then
If cursCol <= Len(text$) + 1 Then 'lets not be printing in no mans land!
text$ = Mid$(text$, 1, cursCol - 1) + Chr$(kh&) + Mid$(text$, cursCol)
cursCol = cursCol + 1
End If
ElseIf kh& = 8 Then ' back space
If cursCol > 1 Then
text$ = Mid$(text$, 1, cursCol - 2) + Mid$(text$, cursCol)
cursCol = cursCol - 1
End If
ElseIf kh& = 21248 Then 'delete
text$ = Mid$(text$, 1, cursCol - 2) + Mid$(text$, cursCol)
End If
_Display
_Limit 60
Loop
Sub myCurs (row, col) ' use row col like for Locate
'Locate row, col
Static As Long lc, toggle
lc = lc + 1
If lc > 1000000 Then lc = 0
If lc Mod 20 = 0 Then toggle = 1 - toggle
If toggle Then c~& = _RGB32(255, 255, 255) Else c~& = _RGB32(0, 0, 0)
Line ((col - 1) * 8, (row - 1) * 16)-Step(0, 15), c~&
End Sub
b = b + ...