Problem in detecting user input with 4GL
Posted in 1995
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
Hi, I've got a requirement to display some data ten lines at a time to the screen with a wait between each display. During the wait the program needs to detect if the user has pressed a key and if so go and do something else before displaying the next ten lines. Does anyone have any ideas on how this could be done. To be more precise: Is there any way of determining if a key has been pressed in a 4GL program other than in the usual way of doing so in an input, display array, prompt, and int_flag tests. The listing below highlights what I'm trying to do, I.E. I need to have a continuous automatic screen scrolling, with no user input of page up/down, arrow-up/down etc.. FUNCTION scroll_logs() DEFINE fs_count , fs_i SMALLINT, fa_cl_ap ARRAY[10] OF RECORD ap_pr_priority INTEGER, cl_status CHAR(8), ... ... END RECORD DECLARE fc_curs CURSOR FOR SELECT * FROM ......... WHERE ......... LET fs_count = 1 FOREACH fc_curs INTO fa_cl_ap[fs_count].* LET fs_count = fs_count + 1 IF fs_count < 10 THEN CONTINUE FOREACH END IF LET fs_count = 1 CALL set_count(10) INPUT ARRAY fa_cl_ap WITHOUT DEFAULTS FROM scr_ap.* BEFORE ROW EXIT INPUT END INPUT --- I need to test at this point if the user has pressed , say, a --- function key to allow the --- program to go off (e.g. call a function ) and do some unrelated --- 4GL processing. SLEEP 15 FOR fs_i = 1 TO 10 INITIALIZE fa_cl_ap[fs_i].* TO NULL DISPLAY fa_cl_ap[lfs_i].* TO scr_ap[fs_i].* END FOR END FOREACH END FUNCTION The preferred method of resolving this would be to use 4GL only, rather than resort to writing a C or a shell script function to test if the user has pressed a key or not. Are there any undocumented features which might provide this functionality ? Also, is there any way of mapping control-c (interrupt) to a function key in a 4GL program? The 'options' clause seems to allow mapping of everything but the interrupt key. All help greatly appreciated. Thanks, K.