The function fgl_getfieldname() returns the name of the currently active field, i.e., the name of the field in which the cursor is currently positioned. It requires no argument passed to it.
The function returns a CHAR(n) datatype value that is the name of the currently active field.
MAIN
DEFINE
rec1 RECORD
f1 char(20),
f2 char(20)
end record
OPEN WINDOW w1 WITH FORM "fgl_dialog_getfieldname_function"
INPUT BY NAME rec1.* WITHOUT DEFAULTS
ON KEY (F2)
IF INFIELD(F1) THEN
MESSAGE "Field: ", fgl_dialog_getfieldname()
END IF
IF INFIELD(F2) THEN
MESSAGE "Field: ", fgl_dialog_getfieldname()
END IF
END INPUT
CLOSE WINDOW w1
END MAIN
example form code
DATABASE FORMONLY
SCREEN
{
[f1 ]
[f2 ]
}
ATTRIBUTES
f1=FORMONLY.f1;
f2=FORMONLY.f2;
INSTRUCTIONS
SCREEN RECORD s_rec (
FORMONLY.f1,
FORMONLY.f2
)
DELIMITERS "[]"
Field name is displayed in the message line if F2 pressed by the user.