diff --git a/addbook.rex b/addbook.rex index db73b66..16e7ce0 100755 --- a/addbook.rex +++ b/addbook.rex @@ -68,4 +68,3 @@ Exit ::requires 'ooSQLite.cls' ::requires "rxunixsys" LIBRARY ::requires 'ncurses.cls' - diff --git a/app/appui.cls b/app/appui.cls index d2e96e8..856f0e6 100644 --- a/app/appui.cls +++ b/app/appui.cls @@ -186,7 +186,7 @@ self~dropWindow(formwin) RETURN END - phone = self~getInputField(formwin, 5, 14, 15) + phone = self~getInputField(formwin, 5, 10, 15) if phone = .nil then do self~dropWindow(formwin) RETURN @@ -196,7 +196,7 @@ self~dropWindow(formwin) RETURN END - email = self~getInputField(formwin, 6, 14, 30) + email = self~getInputField(formwin, 6, 10, 30) if email = .nil then do self~dropWindow(formwin) RETURN @@ -397,7 +397,6 @@ self~setupMainMenu(win) menuwin~refresh() - RETURN /************************ @@ -410,17 +409,23 @@ win~curs_set(1) /* Show cursor */ win~keypad(1) /* Enable function keys and arrow keys */ win~echo() /* Show typed characters */ - /* win~raw */ + win~raw buffer = "" + blank_line = copies(" ", maxlen) /* String of spaces for clearing the line */ do forever key = win~getch() + + decimalKey = C2D(key) + /* Debug: Display key decimal value */ + /* win~mvaddstr(12, 2, "Key pressed (decimal): " || decimalKey || " ") */ + + select when key = D2C(27) then do /* ESC key */ win~curs_set(0) /* Hide cursor */ win~noecho() /* Stop showing typed characters */ - win~mvaddstr(8, 2, "Decimal: "C2D(key) ) return .nil /* Return nil to indicate cancellation */ end when key = D2C(10) | key = D2C(13) then do /* Enter key */ @@ -428,12 +433,14 @@ win~noecho() /* Stop showing typed characters */ return buffer /* Return the entered text */ 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 buffer = buffer~left(buffer~length - 1) win~move(y, x) - win~addstr(buffer || " ") /* Erase the last character */ - win~move(y, x + buffer~length - 1) + win~addstr(buffer || " ") + win~move(y, x + buffer~length) end end otherwise do @@ -533,6 +540,19 @@ end 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 use arg array, item do i = 1 to array~items diff --git a/db/contacts.sqlite b/db/contacts.sqlite index e81d6e0..a75cbd5 100644 Binary files a/db/contacts.sqlite and b/db/contacts.sqlite differ