fix quit selection

This commit is contained in:
Greg Gauthier 2025-05-05 21:44:11 +01:00
parent 4f0071c711
commit 5e81a528a9
2 changed files with 17 additions and 16 deletions

View File

@ -19,8 +19,6 @@ Do forever
if .environment['STOPNOW'] = 1 then do
app~cleanup() /* Clean up before exiting */
call SysCls
/* Say .environment["REXX_PATH"] */
/* Say "Address Book Exited." */
exit 0
end
app~reloop()

View File

@ -146,30 +146,29 @@
self~DrawMenu(menuwin, menu_items, .environment~selected, win)
menuwin~refresh
end
when key = D2C(81) | key = D2C(113) | key = "q" | key = C2D("q") then do
menuwin~endwin
.environment['STOPNOW'] = 1
when key = D2C(81) | key = D2C(113) then do /* Q for quit */
call SysWait 0.25
.environment~selected = self~findInArray(menu_keys, key)
self~ProcessSelection(menuwin, menu_keys[.environment~selected])
RETURN
end
END
when key = D2C(10) | key = D2C(13) then do /* Enter key - numeric codes only */
menuwin~mvaddstr(19 - 1, 18, "Letter selection ["||menu_keys[.environment~selected]||"]")
menuwin~refresh
call SysWait 0.25
self~ProcessSelection(menuwin, menu_keys[.environment~selected])
return
end
otherwise do
if datatype(key) = 'CHAR' then do
key = lower(key)
pos = self~findInArray(menu_keys, key)
if pos > 0 then do
poz = self~findInArray(menu_keys, key)
if poz > 0 then do
.environment~selected = poz
self~DrawMenu(menuwin, menu_items, .environment~selected, win)
menuwin~mvaddstr(19 - 1, 18, "Letter selection ["||key||"]")
menuwin~refresh
call SysWait 0.25
self~ProcessSelection(menuwin, key)
return
end
end
end /* if pos > 0 */
end /* otherwise */
end /* select */
/* Only redraw if selection changed */
@ -210,7 +209,7 @@
call SysWait 0.25
END
when key_char = 'q' then do
menuwin~mvaddstr(19 - 3, 5, "Exiting The Application... ");
menuwin~mvaddstr(19 - 3, 5, "Exiting the application... ")
menuwin~refresh
call SysWait 0.25
menuwin~endwin
@ -228,7 +227,11 @@
return 0 /* Not found */
::method cleanup
expose win
expose win menuwin
/* Clean up ncurses */
menuwin~endwin
win~endwin
return
exit 0
return