Re: Can 4GL do a NEXT FIELD to a screen array element?
Posted in 1991
Path: emory!swrinde!cs.utexas.edu!uunet!trac2000!das13!dave From: dave@das13.snide.com (Dave Snyder) Newsgroups: comp.databases.informix Message-ID: <1523@das13.snide.com> Date: 22 Oct 91 12:30:05 GMT References: <1991Oct18.224210.20229@group1.UUCP> <1991Oct21.173634.21933@sequent.com> Organization: Snide Inc. - Folcroft, PA In article <1991Oct21.173634.21933@sequent.com>, lugnut@sequent.com writes: > In article <1991Oct18.224210.20229@group1.UUCP> van@group1.uucp (Van Bagnol) writes: > Subject: eflastkey > > Undoccumented "feature" > > NOW you can read the direction of approach and conditionaly branch > BEFORE and AFTER FIELD, ROW stmts.... I4GL ONLY!!!!!!!!! > > UP arrow = 2000 > DOWN arrow = 2001 (also linefeed) > LEFT arrow = 2002 > RIGHT arrow = 2003 > > RETURN = 13 > INTERUPT = 2011 > TAB = 9 > > USEAGE > > DEFINE elastkey SMALLINT <in GLOBALS > > > > AFTER FIELD hot_dog > IF p_file.hot_dog IS NULL AND eflastkey != 2000 > THEN > EXIT INPUT > END IF > > In an input array stmt this allows my users to move back UP to edit a > row previously entered, but NOT to enter a blank line followed by non > blank ones. :-) This is not entirely true, eflastkey can be accessed through I4GL and R4GL. The custom "usr_funcs.c" module that comes with db4glgen allows programmers to call a function that will return eflastkey. Also, the comparing of eflastkey to some number is not really the way to code. This is from the README enclosed with db4glgen... Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip DB4GLGEN(1) DB4GLGEN(1) NAME db4glgen - generates 4gl code for a basic "query-by-example" screen SYNOPSIS db4glgen -d dbname -t tabname [-b FIELD1 -b FIELD2] [-f] progname DESCRIPTION "db4glgen" generates Informix-4GL code, C code, and a Makefile to build a basic query-by-example screen. The -d option is used to specify a database. The -t option is used to specify the table which the screen will query against. progname is the name of the file that will contain the 4GL source code. The optional -f flag will force over-writing of pre-existing code. The optional -b flags will insert "browse" code in with the generated 4GL code. If db4glgen finds the file $INFORMIXDIR/bin/fglpc, it will create a Makefile and "fgiusr.c" file for Informix-RDS. ALSO The following functions are in usr_funcs.c and can be used in the 4GL code generated by db4glgen. fgl_prtscr() - This function will print the screen including windows. fgl_getkey() - This function waits for a key to be hit and returns its value. fgl_getenv() - This function returns a value for an environment variable. fgl_lastkey() - This function returns the value of the last key pressed. fgl_keyval() - This function returns the numeric value of a key name. NOTES Be sure to modify the "#define LT_FOUR_ONE" in fgiusr.c and/or usr_funcs.c to meet your needs. Makefile-4gi has a target for "newfgldb" (for people with the Debugger) The "bform" generated by db4glgen with the -b options will default FIELD1 to 10 characters and FIELD2 to 20 characters. Tweek as necessary. Warning statements during compiling with Informix-4GL (not RDS) are caused by the "ON KEY" clauses in the two "INPUT BY NAME" calls. They can be ignored as they are just warnings. fgl_keyval() is designed to be used with fgl_lastkey() and fgl_getkey(). Page 1 (printed 10/13/91) DB4GLGEN(1) DB4GLGEN(1) EXAMPLES IF fgl_getkey() = fgl_keyval("F3") THEN ..... or DEFINE lastkey INTEGER INPUT BY NAME w_record.* AFTER FIELD field1 LET lastkey = fgl_lastkey() IF lastkey = fgl_keyval("DOWN") THEN ..... ELSE IF lastkey = fgl_keyval("UP") THEN ..... BUGS Yup, there probably are some. Page 2 (printed 10/13/91) Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip DAS -- David A. Snyder @ Snide Inc. - Folcroft, PA Current Release is db4glgen-2.4 UUCP: ..!uunet!das13!dave INTERNET: dave@das13.snide.com