2. Language Elements : Variables : Field and Menu Item Variables
 
Share this page                  
Field and Menu Item Variables
Field and menu item variables are variables that are associated with the value in a field or menu item. These variables are not associated with the object represented by the field or menu item. When you create a field or menu item in the OpenROAD Workbench, you generally specify a variable name on the Property Inspector. This variable is associated with the data displayed in the field. You can reference this variable in your 4GL code whenever you need to access the data in the field.
For example, assume that you create an entry field and enter the variable name as title. You can set the value in that field with the following statement:
title = 'Destry Rides Again';
It is not necessary to declare field and menu item variables in your scripts; OpenROAD declares them automatically when you create the field or menu item in the OpenROAD Workbench.
To reference the object represented by a field or menu item instead of its value, use the field function, as described in Field Function (see Field Function), with the field or menu item variable. For example, the following statement changes the background color of the previously described entry field:
field(title).BgColor = CC_ORANGE;
For more information about the field function, see Field Function (see Field Function).