Which form item has the focus?
Identify what element of the current form has the focus.
Sometimes it is important to know which form element has currently the focus. This is
especially important when implementing a DIALOG
block, that can control several
parts of a form. For example, when several lists are driven by multiple DISPLAY
ARRAY
sub-dialogs, you may need to know which is the current list.
To get the name of the current form item, use the DIALOG.getCurrentItem()
method. This method is the replacement of the former
fgl_dialog_getfieldname()
built-in function. It has been extended to return
identifiers for fields, lists, or actions identifiers.
DIALOG ATTRIBUTES(UNBUFFERED)
DISPLAY ARRAY p_orders TO orders.*
...
END DISPLAY
DISPLAY ARRAY p_items TO items.*
...
END DISPLAY
...
IF DIALOG.getCurrentItem() == "items" THEN
...
END IF
...
END DIALOG
It is also possible to detect when the focus enters or leaves a
field or a group of fields by using control blocks such as BEFORE
INPUT
/BEFORE DISPLAY
or AFTER INPUT
/
AFTER DISPLAY
.