Variable fields can serve as input or output text in a form. Each
variable field is based on an EGL primitive or a DataItem part. Unlike
constant fields, variable fields can be accessed by EGL code. To insert
a variable field into a form, follow these steps:
- Open a form group in the EGL Text Form editor.
- If the form group has no forms, add a form to the form group.
See Creating a simple text or print form.
- On the Palette view, click a type of variable field to add. The
following types of variable fields are available by default:
Table 1. Variable fields that are available in the Palette view| Field name |
Default color |
Default intensity |
Default highlighting |
Default protection |
| Input |
Green |
Normal |
Underlined |
No |
| Output |
Green |
Normal |
None |
Skip |
| Message |
Red |
Bold |
None |
Skip |
| Password |
Green |
Invisible |
None |
No |
These fields are samples of commonly used variable text
fields in a text-based interface. You can customize the individual
fields after placing them on a form. You can also customize the default
color, intensity, and highlighting of the fields available in the
Palette view. See Setting preferences for the Text Form editor palette entries.
- Within a form in the editor, click and hold the mouse to draw
a rectangle that represents the size and location of the field. A
preview box next to the mouse cursor shows you the size of the field
and its location relative to the form.
Note: You can add a field only
within an existing form.
- When the field is the correct size, release the mouse. The New
EGL Field window opens.
- In the New EGL Field window, type the name of the new field in
the Name field.
- Do one of the following to select the type of field:
- To use a primitive type, click a primitive type from the Type list.
- To use a DataItem part, follow these steps:
- Click dataItem from the Type list.
The Select a DataItem Part window opens.
- In the Select a DataItem Part window, click a DataItem part from
the list or type the name of one.
- Click OK.
- As necessary, type values in the Dimensions field
or fields to set the dimensions of the new variable field.
- If you want to make the field an array, select the Array check
box.
- If the Array check box is selected, click Next and
continue following these steps. Otherwise, click Finish and
stop here. The new field is created and you do not need to follow
the rest of these steps, because they are applicable only if you are
creating an array.
- On the Array Properties page of the New EGL Field window, type
the size of the array in the Array Size field.
- Choose an orientation of Down or Across from
the Index Orientation buttons.
- Under Layout, type the number of vertical
and horizontal fields in the Fields Down and Fields
Across fields.
- Under Spaces, type the amount of space
between the array's rows and columns in the Lines between
rows and Spaces between columns fields.
- Click Finish. The new field is created
in the form group.
After you have created the new field, click the field to select
it and set the properties for the field in the Properties view. For
more information about properties for form fields, see Form field properties.
Be aware that display properties affect the way EGL displays the variable
on a printed form or on the screen, but not the way the variable is
stored. For example, setting the align property
to right for a CHAR variable does not right-align
the contents of the variable; EGL right-aligns the information on
the page or screen only. (For a shortcut to right-justify a variable,
see Right-justifying a character variable.)
Because variable fields have no default value, they can be invisible
if they are not highlighted. To mark each variable field with appropriate
sample text, click the Toggle Sample Values button
at the top of the editor.
After you have created a variable field, you can double-click it
in the editor to open the Edit Type Properties window. From this window
you can edit the field in the following ways:
- Change the field's name by typing a new name in the Field
Name field.
- Select a new type of field from the Type list.
- Change the precision of the field by specifying a new number in
the Precision field.
When you are finished editing the properties for the field in the
Edit Type Properties window, click OK.
Changing the default size of a variable field
The
default size of a text form variable field in EGL is 10 characters.
You can change this default size in the EGL preferences by clicking .
You can
change the default display properties of any of the displayed palette
entries. For any of the Variable Fields entries,
one of those properties is Default Size.
In VisualAge® Generator, the default
size for a variable field was 1 character. This meant that you could
insert this smaller field in places that the 10-character EGL field
does not fit. You can recreate the VisualAge Generator
behavior by changing the default sizes of all four variable fields
on the Palette Entries page.