It is possible to force the focus by program, to move or stay in
a specific form element, by using the
NEXT FIELD instruction.
The
NEXT FIELD instruction expects a form field
name. When the specified field is the first column identifier of a
sub-dialog driven by a
DISPLAY ARRAY block,
the read-only list gets the focus. If the field name is not
known at compile time, and alternative is to use the
ui.Dialog.nextfield()
method.
DIALOG ATTRIBUTES(UNBUFFERED)
INPUT BY NAME p_cust ATTRIBUTES(NAME="cust")
...
END DISPLAY
DISPLAY ARRAY p_orders TO orders.*
...
END DISPLAY
ON ACTION go_to_header
NEXT FIELD cust_num
ON ACTION go_to_detail
NEXT FIELD order_lineno
...
END DIALOG
When a
BUTTON exist in the form layout, it can
get the focus if the
DIALOG block defines
a
COMMAND clause as action handler. Currently
there is no way to give the focus to a
BUTTON by
program.
DIALOG ATTRIBUTES(UNBUFFERED)
...
COMMAND "print"
CALL print_order()
...
END DIALOG
In some seldom cases (especially when using folder tabs), it may
be need to show a part of the form that is not controlled by
the dialog (i.e. there is no active field or button that can
get the focus in that form part, thus the above techniques cannot
work). To show temporary a given part of the form that cannot
get the focus, use the
ui.Form.ensureFieldVisible() or
ui.Form.ensurelementVisible() methods.
DEFINE form ui.Form
...
DIALOG ATTRIBUTES(UNBUFFERED)
...
BEFORE DIALOG
LET form = DIALOG.getForm()
...
ON ACTION show_image1
CALL form.ensureElementVisible("image1")
...
END DIALOG