Re: 4gl: display array - question
Posted in 1991
Dieter Becker, in your mail you wrote: > > I have two problems in 4gl programming: > > 1. Using 'display array' I want to show the current line with an attribute. > pe. highlighted, inverse, ... But I don't see any easyly programmable > possibility. INFORMIX in the tbmonitor ( informing about databases or > tbspaces) shows this facility. > Don't use DISPLAY ARRAY... use INPUT ARRAY! Here are some examples: Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip DATABASE dbname GLOBALS DEFINE eflastkey SMALLINT END GLOBALS DEFINE program_array ARRAY[100] OF RECORD mark CHAR(1), code LIKE code_table.code, description LIKE code_table.description END RECORD DEFINE array_counter SMALLINT MAIN DEFINE arrcurr SMALLINT DEFINE scrline SMALLINT { This turns off the insert(F1) and delete(F2) keys } OPTIONS INSERT KEY CONTROL-Q, DELETE KEY CONTROL-Q CALL set_count(array_counter) INPUT ARRAY program_array WITHOUT DEFAULTS FROM screen_array.* BEFORE FIELD mark LET arrcurr = arr_curr() LET scrline = scr_line() DISPLAY program_array[arrcurr].* TO screen_array[scrline].* ATTRIBUTE (REVERSE) AFTER FIELD mark LET arrcurr = arr_curr() LET scrline = scr_line() { These 2 lines blank-out any garbage the user might have typed } LET program_array[arrcurr].mark = "" DISPLAY program_array[arrcurr].mark TO screen_array[scrline].mark ATTRIBUTE (REVERSE) { This mess prevents the user from going past the last array row } IF arrcurr >= array_counter THEN { Check last key against UP_ARROW, PAGE_UP, and ACCEPT } IF eflastkey != 2000 AND eflastkey != 2006 AND eflastkey != 2016 THEN ERROR " There are no more rows in the direction you are going " NEXT FIELD mark END IF END IF DISPLAY program_array[arrcurr].* TO screen_array[scrline].* BEFORE FIELD code NEXT FIELD mark END INPUT END MAIN Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip DATABASE dbname SCREEN { --------------------- Code Lookup ----- Code Description ---- ------------------------------ [a|f000][f001 ] [a|f000][f001 ] [a|f000][f001 ] [a|f000][f001 ] [a|f000][f001 ] } TABLES code_table ATTRIBUTES a = FORMONLY.mark, AUTONEXT; f000 = code_table.code; f001 = code_table.description; INSTRUCTIONS DELIMITERS " " SCREEN RECORD screen_array[5] (mark, code, description) Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip BTW, "eflastkey" is an external short in Informix's compiled code and here is a list which defines the values. Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip define KEY_UP 2000 define KEY_DOWN 2001 define KEY_LEFT 2002 define KEY_RIGHT 2003 define KEY_BACKUP 2004 define KEY_NXTSCR 2005 define KEY_PRVSCR 2006 define KEY_LBSAME 2007 define KEY_HELP 2008 define KEY_INSCHAR 2009 define KEY_DELCHAR 2010 define KEY_INTRPT 2011 define KEY_HOME 2012 define KEY_END 2013 define KEY_INSLINE 2014 define KEY_DELLINE 2015 define KEY_ACCEPT 2016 define KEY_DBINIT 2017 # Function Keys corresponding to k0...kA...kZ in termcap. define FKEY_BASE 3000 define KEY_F1 (FKEY_BASE) define KEY_F2 (FKEY_BASE + 1) define KEY_F3 (FKEY_BASE + 2) define KEY_F4 (FKEY_BASE + 3) define KEY_F5 (FKEY_BASE + 4) define KEY_F6 (FKEY_BASE + 5) define KEY_F7 (FKEY_BASE + 6) define KEY_F8 (FKEY_BASE + 7) define KEY_F9 (FKEY_BASE + 8) define KEY_F10 (FKEY_BASE + 9) define KEY_F11 (FKEY_BASE + 10) define KEY_F12 (FKEY_BASE + 11) define KEY_F13 (FKEY_BASE + 12) define KEY_F14 (FKEY_BASE + 13) define KEY_F15 (FKEY_BASE + 14) define KEY_F16 (FKEY_BASE + 15) define KEY_F17 (FKEY_BASE + 16) define KEY_F18 (FKEY_BASE + 17) define KEY_F19 (FKEY_BASE + 18) define KEY_F20 (FKEY_BASE + 19) define KEY_F21 (FKEY_BASE + 20) define KEY_F22 (FKEY_BASE + 21) define KEY_F23 (FKEY_BASE + 22) define KEY_F24 (FKEY_BASE + 23) define KEY_F25 (FKEY_BASE + 24) define KEY_F26 (FKEY_BASE + 25) define KEY_F27 (FKEY_BASE + 26) define KEY_F28 (FKEY_BASE + 27) define KEY_F29 (FKEY_BASE + 28) define KEY_F30 (FKEY_BASE + 29) define KEY_F31 (FKEY_BASE + 30) define KEY_F32 (FKEY_BASE + 31) define KEY_F33 (FKEY_BASE + 32) define KEY_F34 (FKEY_BASE + 33) define KEY_F35 (FKEY_BASE + 34) define KEY_F36 (FKEY_BASE + 35) Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip DAS -- David A. Snyder @ UE&C - Catalytic in Philadelphia, PA UUCP: ..!uunet!trac2000!das INTERNET: das@ueci.com