4gl DISPLAY ARRAY - Highlighting Solution
Posted in 1994
Thanks to all for the responses. Troy Hewitt of Informix was especially helpful. Here is the solution (if you're interested): 4gl Program function() to display menu: --------------------------------------------------------------------------- # # display_menu function # function display_menu(cnt) define cnt integer define p_curr integer define p_line integer open form f_sel from "/usr/local/worms/forms/worms_sel" display form f_sel display by name counter call set_count(cnt) let int_flag = FALSE let selection = 0 while TRUE input array item_rows without defaults from item_rec.* before row let p_curr = arr_curr() let p_line = scr_line() display item_rows[p_curr].* to item_rec[p_line].* attribute(reverse) if p_curr > counter then display item_rows[p_curr].* to item_rec[p_line].* attribute(normal) exit input end if after row let item_rows[p_curr].z = ' ' display item_rows[p_curr].* to item_rec[p_line].* attribute(normal) on key (RETURN) let selection = arr_curr() exit input end input if int_flag then exit while end if end while end function --------------------------------------------------------------- Form definition: --------------------------------------------------------------- database oinc_db screen size 32 by 80 { +---------------------------------------------+-----------+--------------+ | Item Description | Unix Name | Date Created | +---------------------------------------------+-----------+--------------+ [z]|[title ] [unixobj ] [ts ]| [z]|[title ] [unixobj ] [ts ]| [z]|[title ] [unixobj ] [ts ]| [z]|[title ] [unixobj ] [ts ]| [z]|[title ] [unixobj ] [ts ]| [z]|[title ] [unixobj ] [ts ]| [z]|[title ] [unixobj ] [ts ]| [z]|[title ] [unixobj ] [ts ]| [z]|[title ] [unixobj ] [ts ]| [z]|[title ] [unixobj ] [ts ]| [z]|[title ] [unixobj ] [ts ]| [z]|[title ] [unixobj ] [ts ]| [z]|[title ] [unixobj ] [ts ]| +------------------------------------------------------------------------+ | Position the cursor to desired report and hit RETURN to execute, or | | Control-c to cancel. (List of[f1 ]Items) | +------------------------------------------------------------------------+ } end tables worms_data end attributes z = FORMONLY.z; title = worms_data.title, NOENTRY; unixobj = worms_data.unixobj, NOENTRY; ts = worms_data.ts, NOENTRY; f1 = FORMONLY.counter,NOENTRY; instructions screen record item_rec[13] (title, unixobj, ts, z) delimiters " " end ---------------------------------------------------------------------------- This method even prevents users from scrolling past the last line of the array with the BEFORE ROW check of the current row against the number of elements in the array - in this case it re-while's and goes to the top of the menu. COOL !!!!!!! Thanks again, Bill *8o) =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ /*** / ***\\ Hewlett-Packard Company / \\ / Colorado Springs ITC /* / \\ /**\\ /***\\ / \\/ \\ Phone: TN/(719) 590-3402 / \\ \\ Fax: " " 590-3596 / Bill Border \\ \\ EMail: border@cs.itc.hp.com / MVS Technical Support Mailstop: C103G