Field

Use the Field object, along with FieldList, to obtain the information present in a field on the screen.

Table 5-20 Field

Method

 

getAttributes()

Returns the set of attributes specified for this field instance. See AttributeSet.

Returns

{AttributeSet} The set of attributes for this field

getForegroundColor()

Returns the foreground color of the field.

Returns

{Number} the foreground color for this field. These values are defined in the Color object.

getBackgroundColor()

Returns the background color of the field.

Returns

{Number} the background color for this field. These values are defined in the Color object.

getStart()

Returns the starting position of the field. The starting position is the position of the first character of the field. Some host types use a character position to store field level attributes. In this case, the attribute position is not considered the start position.

Returns

{Position} Starting position of the field.

Throws

{RangeError} For zero length fields.

getEnd()

Returns the ending position of the field. The ending position is the position in the presentation space containing the last character of the field.

Returns

{Position} Ending position of the field.

Throws

{RangeError} For zero length fields.

getLength()

Returns the length of the field. For host types that use a character position to store the field attributes, the field length does not include the field attribute position.

Returns

{Number} Length of the field.

getDataCells()

Obtains the data cells that comprise this field. See DataCell.

Returns

{DataCell[]}Data cells that comprise this field.

getText()

Obtains the text from the field.

Returns

{String} field text.

setText()

Sets the field text. For certain host types, like VT, the text is transmitted to the host right away, but in other host types, the text is not transmitted to the host until an Aid key is invoked. If the text is shorter than the field, the text is placed in the host field, and the remainder of the field is cleared. If the text is longer than the host field, then as much text as will fit is placed in the field.

Parameters

{String}Text to set on the field.

Throws

{Error} If the field is protected.

clearField()

Clears the current field in an emulation-specific manner.

Throws

{Error} If the field is protected or clear is not supported.

getPresentationSpace()

Obtains the PresentationSpace which created this field.

Returns

{PresentationSpace} Parent of this field instance.

toString()

Creates a user-friendly description of the field.

Returns

{String} A user readable rendition of the field.