Re: Bug with INPUT/ON KEY ?? (fwd)
Posted in 1994
>From Stuart Kemp: * * * Using INFORMIX-4GL Version 4.11.UC1 RDS on SCO 3.2.4 * * Problem: * If you exit out of an INPUT statement via an ON KEY clause, the * corresponding variable for the current field is not updated. * * In the sample program below, if you change (say) the first character * in the field, then press F5, the result from 'get_fldbuf' is correct, * but "dummy" does not get updated. * * I get the following output from the attached program: * buf = `ired' * dummy = `Fred' * * * Anyone know of a workaround (apart from explicitly testing 'infield()' * for every single field in the ON KEY part) * * Sample program: * * ----- * define buf, dummy char(10) * * main * let dummy="Fred" * open window w1 at 3,3 with form "test3" * display by name dummy * input by name dummy without defaults * on key(f5) * let buf = get_fldbuf(dummy) * exit input * end input * display "buf = `", buf clipped, "'" * display "dummy = `", dummy clipped, "'" * end main * ----- * * ----- test3.per ----- * database formonly * screen * { * Enter:[f001 ] * } * END * * ATTRIBUTES * f001 = formonly.Dummy; * END * * INSTRUCTIONS * DELIMITERS " " * ----- The reason is you are prematurely exitting the INPUT via a key other than INTERRUPT or ACCEPT. That's why Informix came out with the get_fldbuf(). So you can stuff into the variables what was missed. Also, you don't need an infield() for every field in the ON KEY part. The fastest way of doing it would be like: DEFINE pr_input_rec RECORD LIKE table.* INPUT BY NAME pr_input_rec.* WITHOUT DEFAULTS ON KEY ( F5 ) LET pr_input_rec.* = get_fldbuf( pr_input_rec.* ) EXIT INPUT END INPUT Robert Minter |Data Systems Support| \\\\\\_/// Programmer, Software Development | Orange, CA | ( _ _ ) internet: rob@dssmktg.com | Tel: 714.771.0454 | (| ^ |) bangpath: uunet.uu.net!dssmktg!rob| Fax: 714.771.3028 | \\`-'/ #include <disclaimer.h> \\_/