ON KEY / Loss of Buffered Keystrokes
Posted in 1991
Problem: keystrokes in the buffer get lost when an ON KEY clause is executed in an INPUT or INPUT ARRAY statement. For example: FUNCTION get_input() INPUT BY NAME . . . ON KEY (F5) LET exit_flag = TRUE EXIT INPUT END INPUT IF exit_flag THEN RETURN END IF END FUNCTION In the example above, when the F5 key is pressed, anything the user might have entered in the current field is lost and can't be saved. Informix TechInfo #537 states "The problem is that the contents of the internal buffer in the EFICB never gets copied to the program variable until the field is exited normally. The only option (currently) is to access the ICB directly.) We fail to understand, at this site, whatever could be 'abnormal' about exiting a field with a combination of an ON KEY and an EXIT INPUT statement. TechInfo #537 states that "the user is apparently using the facility in an unexpected way." I don't see this to be an unexpected usage; this is more like something you'd *expect* to see! TechInfo #537 said that the only option is to access the ICB directly. How does one do that? Does anyone know? Do we need to cut over to ESQL/C in order to do it, or is there some undocumented way of getting to it via 4GL? Maybe they'll enhance the language to address this problem; here's how we'd suggest they handle it: ============================================================================== NEW OPTION: OPTIONS INPUT BUFFER and OPTIONS INPUT NO BUFFER DEFAULT: OPTIONS INPUT NO BUFFER - maintains compatibility with previous versions of 4GL. Using the OPTIONS INPUT BUFFER statement indicates that 4GL is to save the contents of the input field in the corresponding program variable during INPUT and INPUT ARRAY statements when the ON KEY clause is executed. The default is to throw away the contents of the keyboard buffer during an ON KEY statement, unless the ON KEY statement returns to the current field. FUNCTION example() DEFINE new_info RECORD LIKE tablename.* INITIALIZE new_info TO NULL OPTIONS INPUT WRAP, INPUT BUFFER INPUT BY NAME new_info.* WITHOUT DEFAULTS ON KEY (F5) EXIT INPUT END INPUT OPTIONS INPUT NO WRAP, INPUT NO BUFFER END FUNCTION The programmer now need only check to see if there was a change in the program variable's contents to determine if the data should be saved. ============================================================================== Bill Williams --------------------------- D I S C L A I M E R ------------------------------ The opinions expressed here do not reflect the views of the US Air Force, the Department of Defense, the US Government, or anyone else but ME. So there. ------------------------------------------------------------------------------ A 4GL "CUTTING EDGE" TECHNOLOGY SITE: AT&T 3B2 WITH ONLINE (*GASP!*) ------------------------------------------------------------------------------