AddField (Screen function)
Add a field to an instance of a screen object (Screen class)
A ScreenField can only be defined within the limits of the current screen. The number of rows and columns in the current screen is determined by Screen class methods (Rows and Columns properties). An attempt to define a field outside these boundaries results in request cancellation. If any part of a new screen field would overlap an existing field, the request is cancelled.
[%sfield =] screen:AddField[( [Row= number], [Column= number], - [Width= number], [Color= fieldColor], - [Protected= boolean], [Highlight= highlight], - [Numeric= boolean], [Modified= boolean], - [Invisible= boolean], [Autoskip= boolean], - [Itemid= number], [Strip= boolean], - [Value= string])]
|%sfield||A declared ScreenField object that is set to a new ScreenField object reference.|
|screen||A reference to an instance of a Screen object.|
|Row||Row is an optional, but name required, number indicating the starting row number for the field. The first row in a screen is row 1, and the last can be determined with the Rows method.
Any row number in the screen may be used for a field. No rows are reserved by SOUL. A field may occupy more than one row.
The first position in any field is reserved for an attribute byte, which cannot contain displayable data and appears on a screen as a blank. A field's display data begins by default in the column immediately following the reserved byte.
The Row default value is 1 or the value specified or implied by the previous AddField call.
|Column||Column is an optional, name required, number indicating the first column position in the field. This first column, in any field, is reserved for an attribute byte and cannot contain displayable data (it appears on a screen as a blank). The field's value (display data) begins by default in the column immediately following the reserved column.
The first column in a screen is column 1; the last column can be determined with the Columns method.
The default Column value is one greater than the ending column number of the preceding field, or it is 1 if no previous fields.
|Width||Width is an optional, name required, number indicating the length of the screen field, excluding the attribute byte. The first position in any field is occupied by an attribute byte, which cannot contain user data. The minimum width for a field is |
If no width is specified, the width of the field is determined by the length of the string specified in the method's Value parameter. If neither a Width nor a Value parameter is specified, the request is cancelled. If both Width and Value parameters are specified, the Width parameter is used to set the field width, and the Value is silently padded or truncated accordingly.
|Color||Color is an optional, name required, Fieldcolor enumeration value. Valid values (case unimportant) are |
This parameter explicitly sets the color for a screen field. The Color method lets you reset it.
|Protected||Protected is an optional, name required, Boolean_enumeration value. If |
New fields are protected by default.
The value of this attribute can be reset using the Protected method.
|Highlight||Highlight is an optional, name required, Highlight_enumeration value. Valid values (case unimportant) are: |
A ScreenField may have only one Highlight attribute. The Highlight property lets you reset it. The default is
|Numeric||Numeric is an optional, name required, Boolean enumeration value. If |
Regardless of the value of the Numeric attribute, the programmer can assign any type of value to the field. Enforcement of the Numeric attribute takes place only when a user enters data in the field.
Some terminal emulators do not enforce numeric field restrictions, so the programmer should be aware that the value of a numeric field must still be checked for validity.
|Modified||Modified is an optional, name required, Boolean enumeration value that indicates whether a ScreenField value has been modified by the user. |
Regardless of the initial setting of this argument, the value of the Modified property for a field is always set by the Read method.
|Invisible||Invisible is an optional, name required, Boolean enumeration value. If |
The Invisible property lets you reset the value. The invisible attribute can be applied to protected or nonprotected fields. It is typically used to hide password prompts or other private data, but it does not encrypt or suppress transmission of data over the network. It is intended to minimize theft of private data at terminals situated in non-private areas.
|AutoSkip||AutoSkip is an optional, name required, Boolean enumeration value that indicates whether the cursor should automatically skip to the next input field when a character is entered in the last position of the current ScreenField. |
|Itemid||Itemid is an optional, name required, number that allows the CursorItemID method to identify the screenfield that contains the cursor after a screen read.
The default Itemid number is
Item IDs are most useful when using an Arraylist of ScreenFields, which is commonly done for scrolling applications.
|Value||Value is an optional, name required, string that contains the screen data to be displayed. The Value parameter is simply a convenient way to set display data when the screenfield is instantiated.|
The Value method performs the same work, but can also get user-entered data for a screenField.
|Strip||Strip is an optional, name required, Boolean enumeration that lets you suppress the removal of leading and trailing blanks from input fields. Strip is available as of version 7.5 of Model 204.|
- Each of the screen field attributes specified by the AddField optional parameters corresponds to a like-named ScreenField property.
- Some of those ScreenField properties, such as Row, may not be modified, but others, such as Invisible, may be modified.
- The values of the Modified and Value properties are also set by a user screen-interaction.
For an example using the AddField method, see "Screen object sample code".