The fgl_buffertouched() function is called by a BEFORE or an AFTER {FIELD | INPUT | CONSTRUCT} instruction; it returns an integer value of TRUE or FALSE, which show whether or not the last field has been modified.
This function must be used within a dialog function, such as INPUT, INPUT ARRAY, DISPLAY ARRAY, or PROMPT statements. If it is not you may find errors occurring at compile or runtime.
In the following example, the source code checks the AFTER INPUT block, to find out if the user has modified the field contents; that is, whether data has been entered or changed in this block during input. If data is changed in the f1 field a dialog box will be displayed, showing that "You modified the field contents"; if no data is entered or changed, a message appears stating that "You did not modify the field".
MAIN
DEFINE x CHAR(20)
OPTIONS INPUT WRAP,
ACCEPT KEY RETURN
DEFER INTERRUPT
OPEN WINDOW w_test
AT 2, 2
WITH FORM "fgl_buffertouched_function"
LET x = "This is the original text"
INPUT x WITHOUT DEFAULTS FROM f1
AFTER INPUT
IF NOT fgl_buffertouched() THEN
CALL fgl_message_box("You did not modify the field")
CONTINUE INPUT
ELSE
CALL fgl_message_box("You modified the field contents")
END IF
END INPUT
CLOSE WINDOW w_test
END MAIN
example form file
DATABASE formonly
SCREEN
{
Please edit this form field
[f1 ]
}
ATTRIBUTES
f1=formonly.f1;
INSTRUCTIONS
DELIMITERS "[]"