ui.Dialog.setCurrentRow
Sets the current row in the specified list.
Syntax
setCurrentRow(
name STRING,
row INTEGER )
- name is the name of the screen record, see Identifying screen-arrays in ui.Dialog methods.
- row is the new row in the array.
Usage
setCurrentRow()
method to change the current row in an INPUT
ARRAY
or DISPLAY ARRAY
list. You must pass the name of the screen array to
identify the list, and the new row
number.DEFINE x INTEGER
DIALOG
DISPLAY ARRAY custlist TO sa_custlist.*
...
END DISPLAY
ON ACTION goto_x
CALL DIALOG.setCurrentRow("sa_custlist", x)
...
Moving to a different row with setCurrentRow()
will not trigger control blocks such as BEFORE ROW
/
AFTER ROW
, as the fgl_set_arr_curr()
built-in function does.
The setCurrentRow()
method will not set the focus; you need to use NEXT
FIELD
to set the focus to a list. (This works with DISPLAY ARRAY
as well
as with INPUT ARRAY
.)
If the passed row index is lower than 1, the first row will be selected. If the row index is greater than the total number of rows, the last row will be selected.
If the new current row is not in the current view, the dialog will adapt the list offset to make the new current row visible.
If multi-row selection is enabled, all selection flags of rows are cleared, and the new current row gets automatically selected.
A setCurrentRow(screen-array,row-index)
in
a paged mode DISPLAY ARRAY
will subsequently trigger the ON FILL BUFFER
code, if the requested row is not in
the current page of visible rows.
If DISPLAY ARRAY
using ON FILL BUFFER
was started with
COUNT=-1
, and the row-index provided by
setCurrentRow()
is greater as the actual number of rows already fetched through
ON FILL BUFFER
, setCurrentRow()
will have no effect. The actual
number of rows must be provided with DIALOG.setArrayLength(screen-array,count)
where count >= row-index, before calling
setCurrentRow()
:
DISPLAY ARRAY ... ATTRIBUTES(COUNT=-1)
ON FILL BUFFER
...
ON ACTION goto_last_row
SELECT COUNT(*) INTO cnt FROM ... -- Count total rows
CALL DIALOG.setArrayLength("sr", cnt)
CALL DIALOG.setCurrentRow("sr", cnt)
...