FINALLY fixed the backspace problem.

This commit is contained in:
Greg Gauthier 2025-05-08 20:57:47 +01:00
parent a1a067d417
commit 8b67f882dc
3 changed files with 28 additions and 9 deletions

View File

@ -68,4 +68,3 @@ Exit
::requires 'ooSQLite.cls' ::requires 'ooSQLite.cls'
::requires "rxunixsys" LIBRARY ::requires "rxunixsys" LIBRARY
::requires 'ncurses.cls' ::requires 'ncurses.cls'

View File

@ -186,7 +186,7 @@
self~dropWindow(formwin) self~dropWindow(formwin)
RETURN RETURN
END END
phone = self~getInputField(formwin, 5, 14, 15) phone = self~getInputField(formwin, 5, 10, 15)
if phone = .nil then do if phone = .nil then do
self~dropWindow(formwin) self~dropWindow(formwin)
RETURN RETURN
@ -196,7 +196,7 @@
self~dropWindow(formwin) self~dropWindow(formwin)
RETURN RETURN
END END
email = self~getInputField(formwin, 6, 14, 30) email = self~getInputField(formwin, 6, 10, 30)
if email = .nil then do if email = .nil then do
self~dropWindow(formwin) self~dropWindow(formwin)
RETURN RETURN
@ -397,7 +397,6 @@
self~setupMainMenu(win) self~setupMainMenu(win)
menuwin~refresh() menuwin~refresh()
RETURN RETURN
/************************ /************************
@ -410,17 +409,23 @@
win~curs_set(1) /* Show cursor */ win~curs_set(1) /* Show cursor */
win~keypad(1) /* Enable function keys and arrow keys */ win~keypad(1) /* Enable function keys and arrow keys */
win~echo() /* Show typed characters */ win~echo() /* Show typed characters */
/* win~raw */ win~raw
buffer = "" buffer = ""
blank_line = copies(" ", maxlen) /* String of spaces for clearing the line */
do forever do forever
key = win~getch() key = win~getch()
decimalKey = C2D(key)
/* Debug: Display key decimal value */
/* win~mvaddstr(12, 2, "Key pressed (decimal): " || decimalKey || " ") */
select select
when key = D2C(27) then do /* ESC key */ when key = D2C(27) then do /* ESC key */
win~curs_set(0) /* Hide cursor */ win~curs_set(0) /* Hide cursor */
win~noecho() /* Stop showing typed characters */ win~noecho() /* Stop showing typed characters */
win~mvaddstr(8, 2, "Decimal: "C2D(key) )
return .nil /* Return nil to indicate cancellation */ return .nil /* Return nil to indicate cancellation */
end end
when key = D2C(10) | key = D2C(13) then do /* Enter key */ when key = D2C(10) | key = D2C(13) then do /* Enter key */
@ -428,12 +433,14 @@
win~noecho() /* Stop showing typed characters */ win~noecho() /* Stop showing typed characters */
return buffer /* Return the entered text */ return buffer /* Return the entered text */
end end
when key = D2C(8) | key = D2C(127) then do /* Backspace */ when decimalKey = 3290675 then do
/* when key = D2C(8) | key = D2C(26) | key = D2C(127) */
/* I don't know why the standard ASCII codes don't work! */
if buffer~length > 0 then do if buffer~length > 0 then do
buffer = buffer~left(buffer~length - 1) buffer = buffer~left(buffer~length - 1)
win~move(y, x) win~move(y, x)
win~addstr(buffer || " ") /* Erase the last character */ win~addstr(buffer || " ")
win~move(y, x + buffer~length - 1) win~move(y, x + buffer~length)
end end
end end
otherwise do otherwise do
@ -533,6 +540,19 @@
end end
return return
::METHOD stripChar263
use arg inputString
outputString = ""
do i = 1 to inputString~length
char = inputString~substr(i, 1)
if C2D(char) \= 263 then
outputString = outputString || char
end
return outputString~changeStr("263", "")
::METHOD findInArray ::METHOD findInArray
use arg array, item use arg array, item
do i = 1 to array~items do i = 1 to array~items

Binary file not shown.