The buffer is used to store the values of a field before they are written to the input variable. The contents are normally written to the variable when either an accept action is performed or the field is navigated away from. If the contents of the fields are required for any reason – without writing the values to the underlying input variable – then this function is used to get the contents of the buffer.
This function can be used with a dedicated get cursor or key; in this example the F2 keyboard key is used. After typing the required text into the Input Field press the F2 key and the function will write the value of the current field to Field Buffer field. In other words, the value returned by this function will be the value equal to the value shown in the key field when the function was invoked.
MAIN
DEFINE x CHAR(20)
DEFINE y CHAR(20)
LET x = "Sample input data"
OPEN WINDOW w_test
AT 2, 2
WITH FORM "fgl_dialog_getbuffer_function"
OPTIONS INPUT WRAP
INPUT x WITHOUT DEFAULTS FROM f1
BEFORE INPUT
DISPLAY x TO f2
ON KEY (F2)
LET y = fgl_dialog_getbuffer()
DISPLAY y TO f3
DISPLAY x TO f2
END INPUT
END MAIN
.per form code
DATABASE FORMONLY
SCREEN
{
[f1 ]
[f2 ]
[f3 ]
}
ATTRIBUTES
f1=FORMONLY.f1;
f2=FORMONLY.f2;
f3=FORMONLY.f3;
INSTRUCTIONS
SCREEN RECORD s_rec (
FORMONLY.f1,
FORMONLY.f2,
FORMONLY.f3
)
DELIMITERS "[]"