In cases where you want to map database fields or other program variables to the user interface, input field controls and selection box controls may be linked to Natural variables. This makes it easier to modify and query them.
If the end user has entered data in an input-field control or a sebox
control and sets the focus to another dialog element, a leave event occurs and
the content (STRING
) is moved to the variable. Thus, the variable
is updated. Note that the variable will not be updated if the end user
enters data and a change event occurs.
To refresh the content of the dialog element after the linked variable has been modified in code
Use the PROCESS GUI
statement action
REFRESH-LINKS
.
Modifying and querying input field controls with the
ASSIGN
statement would
normally work like this:
... #IF-1.STRING := '12345' #TEXT := #IF-1.STRING ...
However, you can also link a Natural variable to the input field control or selection box control. You can also link an indexed variable to a dialog element or an array of dialog elements.
To link a variable in Natural code, set the attribute
LINKED
to
TRUE
and modify the attribute VARIABLE
by
setting it to the Natural variable name:
... #IF-1.LINKED := TRUE #IF-1.VARIABLE := MYVARIABLE ...
Double-click on your input field control. The corresponding attributes window appears.
Choose the String entry. The Source for handlename dialog box appears.
button to the right of theChoose Linked variable.
Enter the variable name (such as MYVARIABLE
in the example
above).
There are two possibilities to link an indexed variable such as
MYVARIABLE (A20/1:5)
:
you link a single dialog element to the indexed variable; then you
specify the index, such as MYVARIABLE(2)
in the variable name
field of the Source for
handlename dialog box, or
you link an array of dialog elements to the indexed variable; then you
do not specify an index in the variable name field. In this case, the
occurrences of the array and the index of the variable must be compatible.
MYVARIABLE (A20/1:5)
could be linked to a one-dimensional array
with up to five occurrences.