Re: Getting last key pressed in 4GL
Posted in 1994
Andrey Yu. Grachyov <andy@tern.msk.su> writes: >} Michel Behna (mbehna@promus.com) wrote: >} Look at fgl_lastkey() function. I know it was undocumented and if you need the >As far as I undestand, fgl_lastkey() function is useful within CONSTRUCT >or INPUT statements only. So, that's the reason Dirch's program below >doesn't work. Am i right? Yes. The only keys trapped in an infinite loop are INTERRUPT (via DEFER INTERRUPT) and QUIT (stty kill; usually CONTROL-\\; via DEFER QUIT). fgl_lastkey() requires an INPUT or CONSTRUCT statement. I've even tried tricky things like: BEFORE FIELD a IF fgl_laskey() ... THEN CALL do_something() ELSE CALL keep_looping() END IF NEXT FIELD a To use an INPUT statement without ever actually getting into a field and thus causing a loop until a key is hit, to no avail. The only suggestion I have is to modify the terminal function keys to send out an INTERRUPT as well as their TERMCAP definition, then you could: WHILE looping IF int_flag THEN LET int_flag = FALSE PROMPT ":" FOR CHAR ans ON KEY(F#) CALL do_something() ... END PROMPT END IF END WHILE Then, when the user hits the function key, int_flag is set, we jump into and out of the PROMPT becuase the function key was hit, and we would continue processing after doing whatever do_something does. ============================================================ Dennis J. Pimple Informix Software Inc Senior Consultant Denver Colorado USA dennisp@informix.com Voice:303-850-0210 Fax:303-779-4025