The fgl_dialog_setcurrline() function displays a specified row of the program array at a specified line of the screen array.
The fgl_dialog_setcurrline function takes two comma-separated arguments (screen_line, prog line), where screen line is the screen line number in the array, and prog line is the row number in the program array.
The code sample below creates a display using two ON KEY options. When you press the F4 key, the 4th row of the program record is displayed.
MAIN
DEFINE x1 ARRAY[10] OF RECORD
a CHAR(10),
b CHAR(10),
c CHAR(10)
END RECORD
DEFINE i SMALLINT
OPEN WINDOW w_test
AT 2, 2
WITH FORM "fgl_dialog_setcurrline_function"
FOR i = 1 TO 10
LET x1[i].a = "Line", i USING "<&"
LET x1[i].b = "AAAAAAAAAAA"
LET x1[i].c = "BBBBBBBBBBB"
END FOR
CALL set_count(10)
INPUT ARRAY x1 WITHOUT DEFAULTS FROM sc_rec.*
ON KEY (F1)
CALL fgl_dialog_setcurrline(1,1)
ON KEY (F2)
CALL fgl_dialog_setcurrline(2,2)
ON KEY (F3)
CALL fgl_dialog_setcurrline(3,3)
ON KEY (F4)
CALL fgl_dialog_setcurrline(4,4)
ON KEY (F5)
CALL fgl_dialog_setcurrline(5,5)
ON KEY (F6)
CALL fgl_dialog_setcurrline(6,6)
ON KEY (F7)
CALL fgl_dialog_setcurrline(7,7)
END INPUT
CLOSE WINDOW w_test
END MAIN
DATABASE formonly
SCREEN
{
[f001 ] [f002 ] [f003 ]
[f001 ] [f002 ] [f003 ]
[f001 ] [f002 ] [f003 ]
[f001 ] [f002 ] [f003 ]
[f001 ] [f002 ] [f003 ]
[f001 ] [f002 ] [f003 ]
[f001 ] [f002 ] [f003 ]
}
ATTRIBUTES
f001=formonly.f1;
f002=formonly.f2;
f003=formonly.f3;
INSTRUCTIONS
SCREEN RECORD sc_rec[7] (
formonly.f1,
formonly.f2,
formonly.f3
)
DELIMITERS "[]"
After executing the program, an array appears with three columns and a scroll bar.
If you press F4, the screen array is displayed with the fourth row being the current line in the display.