Carapace

Screen Class

The Screen class assists the mapping of protocols which represent screens of information to the user -- such as Videotex. Data received down a comms line can be put on the screen and then analysed.

Triggers can be set up on the screen which fire when their trigger-conditions are satisfied. The list of available trigger types is as follows:

home the 'home' character is received
reset the 'reset' character is received
cursorOn the 'cursor-on' character is received
cursorOff the 'cursor-off' character is received
hotText the supplied text appears at the given position on screen
hotPatch the cursor enters the supplied region of the screen
exitZone the cursor leaves the supplied region of the screen
messageRow a message appears on the supplied row of the screen

Screen Creation

The create function can be used to create a Screen object of a given no. of rows and columns e.g.

    (create Screen 24 40)
Once created, this module is tailored using its properties and methods.

Screen Properties

A Screen object supports the following properties:

property name property type description
row Integer current display row (0 based)
column Integer current display column (0 based)
nRows Integer number of rows on the screen
nColumns Integer number of columns on the screen
carriageReturnChar Integer character used as the 'carriage return' character to go to the start of the row
lineFeedChar Integer character used as the 'line-feed' character to go down a row
homeChar Integer character used as the 'home' character to go to the initial row and column without changing the screen contents
resetChar Integer character used as the 'reset' character to go to the initial row and column and clearing the screen
cursorOnChar Integer character used as the 'cursor-on' character which turns on the display of the cursor
cursorOffChar Integer character used as the 'cursor-off' character which turns off the display of the cursor
escapeChar Integer character used as the 'escape' character which makes the following character have a special meaning
verticalTabChar Integer character used as the 'vertical tab' character to go up one row
backspaceChar Integer character used as the 'backspace' character to go back one character
tabChar Integer character used as the 'tab' character to go forward one character
log Log a log for the screen

Screen Methods

The Screen object supports the following methods:

method namedescription
display display the supplied text on the screen at the current cursor position
displayAt display the supplied text on the screen at the supplied cursor position
extract extract text from the screen from the supplied position
home 'go home' i.e. move to the initial row and column without changing the screen content
reset reset the screen i.e. move to the initial row and column and clear the screen
up move the cursor position up one line
down move the cursor position down one line
left move the cursor position one character to the left
right move the cursor position one character to the right
cursor return the current cursor position
isCursorOn test if the cursor display is turned on
cursorOn turn the display of the cursor on
cursorOff turn the display of the cursor off
toHtml return an HTML representation of the screen content
enableTrigger enable the identified trigger
disableTrigger disable the identified trigger
triggerDisplay display the supplied text and fire any appropriate enabled triggers
viewer set up a COM object as a viewer to track the display of data on the screen
string return a string representation of the screen
fromString fill the screen from the supplied string representation
find find the supplied piece of text on screen


display

Display the supplied text on the screen at the current cursor position.

Arguments:

dataString or Binary

Return type: the empty List ()


displayAt

Display the supplied text on the screen at the supplied cursor position -- the current cursor position is not affected.

Arguments:

dataString or Binary
rowInteger
columnInteger

Return type: the empty List ()


extract

Extract text from the screen from the supplied position.

Arguments:

rowInteger
columnInteger
lengthInteger

Return type: String


home

'Go home' i.e. move to the initial row and column without changing the screen content.

Arguments: none

Return type: the empty List ()


reset

Reset the screen i.e. move to the initial row and column and clear the screen.

Arguments: none

Return type: the empty List ()


up

Move the cursor position up one line.

Arguments: none

Return type: the empty List ()


down

Move the cursor position down one line.

Arguments: none

Return type: the empty List ()


left

Move the cursor position one character to the left.

Arguments: none

Return type: the empty List ()


right

Move the cursor position one character to the right.

Arguments: none

Return type: the empty List ()


cursor

Return the current cursor position as a list of two integers (row column).

Arguments: none

Return type: List


isCursorOn

Test if the cursor display is turned on.

Arguments: none

Return type: the empty List () is returned if the cursor display is off, otherwise non-() is returned.


cursorOn

Turn the display of the cursor on.

Arguments: none

Return type: the empty List ()


cursorOff

Turn the display of the cursor off.

Arguments: none

Return type: the empty List ()


toHtml

Return an HTML representation of the screen content -- this forms the content of an HTML <table> statement.

Arguments: none

Return type: String


enableTrigger

Enable the identified trigger.

Arguments:

The initial argument is the trigger name -- any subsequent arguments are trigger-dependent. Any trigger can be re-enabled simply by supplying its name. Certain triggers require additional arguments when they are set up i.e. when they are initially enabled.

Enabling the following triggers requires no additional arguments:

Setting up the hotText trigger requires the following arguments:

triggerNameString i.e. "hotText"
textString
rowInteger
columnInteger

Setting up the hotPatch trigger requires the following arguments:

triggerNameString i.e. "hotPatch"
rowInteger
columnInteger
nRowsInteger
nColumnsInteger

Setting up the exitZone trigger requires the following arguments:

triggerNameString i.e. "exitZone"
rowInteger
columnInteger
nRowsInteger
nColumnsInteger

Setting up the messageRow trigger requires the following arguments:

triggerNameString i.e. "messageRow"
rowInteger

Return type: the empty List ()


disableTrigger

Disable the identified trigger.

Arguments:

triggerNameString

Return type: the empty List ()


triggerDisplay

Display the supplied text and fire any appropriate enabled triggers.

Arguments:

textString or Binary

Return type: a List of trigger names which have fired


viewer

Set up a COM object as a viewer to track the display of data on the screen.

Arguments:

viewerDispatch

Return type: the empty List ()


string

Return a string representation of the screen.

Arguments: none

Return type: String


fromString

Fill the screen from the supplied string representation.

Arguments:

infoString

Return type: the empty List ()


find

Find the supplied piece of text on screen -- the search starts checking at the supplied screen row and column. If supplied and non-(), the optional 4th argument makes the matching case-insensitive. The default is to do a case-sensitive search.

Arguments:

textString
rowInteger
columnInteger
optional caseSensitivityObject

Return type: List


Contents Index Current topic: communications Related links: objects, built-in objects