Here are the key UIEntryField members--note that all methods are virtual and available to be overridden in a child extension class.
Many values and properties are not virtual as they are generally not expected to be modified--this includes the field's MapID, FieldID, location on the screen, length and so on.
Constructors
There is a simple constructor with only MapID and FieldID -- the main constructor includes values determined from FVStudio properties on the field as it sits in the FieldMap on the screen. Generally all construction of UIEntryField and child class objects is performed in the generated static InitEntryDictionary method.
Since the UIEntryField is constructed only once per process, many useful references are created in the constructor and set to the public values and properties, such as the field length, offset, row, column and so on.
For more detail, please see the generated code for UIEntryField.
Note that as mentioned in the introduction to the class, all methods must be re-entrant and you can expect high concurrency with multiple threads accessing each UIEntryField object at the same time!
Enter
public virtual bool Enter(TaskSession ts, string text, out string errorMessage)
Note that the Enter method is generally not called directly by other objects in your framework, but instead is called by the static methods EnterFieldValue and setIOBagValues.
For any new class implementing an extension to the provided UIEntyField class, this is the method most likely to be overridden! The Enter method needs to (and is expected to):
•Ensure the cursor is positioned to the field in the active screen session (by default uses the PositionTo() method)
•Prepare the text for entry into the field, truncating if the text is longer than the defined field length and padding with blanks if FullBlankPadding is true
•If AutoSkipToNext is false, and NextFieldKey is set, add the NextFieldKey to the text
•Enter the text with a HostScreen.putCommand, waiting up to 2 seconds if nextFieldKey is null or empty
PositionTo
public virtual bool PositionTo(TaskSession ts, out string errorMessage)
The PositionTo is a crucial method in ensuring clean data entry. In cases where the fields being entered are not adjacent, tabbing, cursor movement or other methods must be utilized to accurately position the cursor at the start of the field.
PositionTo in the UIEntryField class is dependent on a number of properties of the field object and behaves as follows:
•If the cursor is at the start of the field, PoitionTo returns true
•FocusKey or PositionCustomKeys (see below table)-- if FocusKey or Custom Keystrokes and PositionCustomKeys is set, this will be sent and PositionTo will wait up to 1 second for the cursor to land at the start of the field. If the cursor is ready, true is returned
•The FieldCursorPositioning property for the field is then used to attempt positioning from the current location to the field's location. In the logic, all known field locations for the active screen are utilized to determine if forward or backward motion is needed to position the cursor. The TabThroughField, SendCursorCUP, SendCursorMoves or MoveTowardsField methods are used as per the below table.
•If the cursor lands in the correct location, true is returned
•If, during movement, the cursor repeats its location, false is returned indicating failure to position the cursor
FieldCursorPositioning Setting |
Method Used |
Direction By Character (default) |
SendCursorMoves -- will use [up], [down], [right] and [left] keys to reposition, assuming a single action moves a single row or column |
Direction By Field |
MoveTowardsField -- will use [up], [down], [tab] and [backtab] to seek from the current field to the target field, assuming that each action moves toward the closest field |
Cursor Position Command |
SendCursorCup -- will use a Cursor Positioning Command to directly move the cursor to the target field start location. Note that in UIEntryField this is a VTxxx CUP sequence of ESC[{row};{column}H -- and that not many hosts support this! |
Custom Keystrokes |
The PositionCustomKeys property is used as FocusKey to provide the keystroke(s) used to move the cursor directly to this field -- note that this is achieved by setting the focusKey for the object to the PositionCustomKeys value, and for this to work, focusKey on the FVStudio property must be empty |