9. PROCESSING › 9.4 Parameter Panel Build and Control Logic › 9.4.2 Panel Driver Module Logic › 9.4.2.1 VMTDSP - Panel Builder/Driver (display) › 9.4.2.1.1 @ScreenFormat Panel Building Routine
9.4.2.1.1 @ScreenFormat Panel Building Routine
The @ScreenFormat routine is initially called at the
beginning of VMTDSP with the name of the main (master) menu
screen file; for the VM Data Transfer Program, this is
VMTMNU. The master menu screen file is brought into memory,
defaults are set from the :SCREEN 0 specification, and all
other screens defined in the master menu screen file are
built. When a subsidiary menu screen is selected,
@ScreenFormat is again called from the @Control routine
(subroutine DoNEWSCREEN).
Within @ScreenFormat, all line text defaults to blank space,
and the default line attributes used in SET RESERVED are
default color, no highlighting, and no protect. The default
field attributes are protect and no highlighting. The escape
character is X'FF'. Lines are first built from the line text
definitions, then field descriptors are inserted into the
text.
The line text is split at the field column minus 1 (that is,
field column number less one), and the field attributes are
inserted into the line. If a length greater than zero is
specified, a reset attribute is inserted in the line at
column plus length. All fields must be defined in ascending
order by column within a line. No checking is done for field
overlap.
If :PFKLINEs are defined, the definition will replace any
existing :LINE definition for the same line. All :PFK
settings must occur before the :PFKLINE, or otherwise the
text is not added to the display line.
@ScreenFormat reads each line of the screen definition file,
and calls subroutines to address the different line types
(e.g. :FIELD, :PFK, :LINE, etc.).
SUBROUTINES
ScreenOnceOnly Called on the first entry to @ScreenFormat,
this routine performs initialization of
variables and sets default XEDIT parameters.
Parameters (entry) - Master menu screen file
name.
Returns - Value of 1 that is assigned to
@ScreenINIT variable to indicate
initialization is complete.
SetScreen Adds a screen definition; parses the :SCREEN
statement. If this is a SCREEN 0
specification, no further processing is
performed. For any other type of screen
definition a check is made to see if the
screen is already defined. If so, arrays
containing the lines of text, line
attributes, and field attributes for the
screen are re-initialized. If the screen is
a menu, the menu list is cleared and re-
initialized. If the screen is new, the
count of screens is incremented, and screen
identification information is saved. For
both previously defined and new screens the
optional identifier and edit function names
are also saved.
Parameters (entry) - The screen name.
SetCursor Saves the initial cursor display position by
parsing the :CURSOR statement. The position
is represented by either a field name, or a
line and column number. If a field name is
specified, the cursor position information
is obtained from the line and column
specifications of the field definition.
Parameters (entry) - The screen name and
number.
TattrDef Builds a line attribute definition; parses
the :TEXTATTR statement; establishes the
attributes for a line to be displayed, or
the default attributes for the screen, such
as protected or non-protected, colors, etc.
Parameters (entry) - The screen name and
number.
LineDef Builds a text line display definition;
parses the :LINE statement for the line
number and text to be displayed on that
line; saves the text for later display.
Parameters (entry) - The screen name and
number.
FieldDef Adds an input field, or fields, to a text
line; parses the :FIELD statement for the
line and column number defining the field
position on the screen. Also saves off-the-
field names, lengths and display attributes.
The routine checks for errors to insure that
a given position on the screen is associated
with only one field name.
Parameters (entry) - The screen name and
number.
KeyDef Builds a program function key definition;
parses the :PFK statement for the PF key
number and function to be performed based on
hitting that key.
Parameters (entry) - The screen name and
number.
KlineDef Builds a PF key line definition used to
display one or more lines at the bottom of
the screen, indicating what action will be
caused by a given PF key. The subroutine
also parses the :PFKLINE statement to
determine which line to use and which keys
to display.
Parameters (entry) - The screen name and
number.
SetMenu Records the menu selection numbers and the
corresponding screen names to be invoked by
a given selection. The subroutine also
parses the :MENU statement.
Parameters (entry) - The screen name and
number.
GetAttribute A function subroutine that returns a
one-byte attribute for a line or field,
based on a character specification of
attributes. GetAttribute is passed a set of
parameters (e.g. PROTECT, PINK, HI), and
translates these into an array index, which,
in turn, is used to obtain a valid attribute
byte via the XEDIT SET CTLCHAR command.
Parameters (entry) - Text string containing
screen attribute abbreviations.
Returns - One-byte screen attribute for a
field or line.
UpAttr A function subroutine used by the
GetAttribute routine to create a string
defined by the attr variable. The string
contains four values indicating which of the
four basic attribute categories has been
specified for a field or text. These
categories are Protect, Color, Extended
Highlighting, and Standard Highlighting.
Parameters (entry) - A string containing up
to four digits, separated by blanks,
representing selected attributes, an
attribute category number, or an attribute
number.
Returns - An updated string reflecting the
selected category and attribute number.
InsAttr A function subroutine used by the FieldDef
routine to place an attribute byte in front
of any defined fields. The subroutine keeps
track of how many attribute bytes are used
in the current screen line so fields are
properly positioned on the screen.
Parameters (entry) - A one-byte attribute
character; the name of the variable
containing the screen line; the column
position in which that attribute should be
inserted in.
Returns - The screen line with the attribute
properly inserted.
AbsLine A function subroutine which returns a real
line number from an input specification. If
the parameter passed to AbsLine is a
positive number, Absline returns that line
number. If the parameter is a negative
number, Absline returns the real line number
relative to the bottom of the screen. If
the letter M is passed to AbsLine as a first
parameter, the real line number relative to
the middle or the screen is returned based
on a positive or negative number as the
second parameter. If no second parameter is
specified with M, the real line number
returned represents the middle line of the
screen.
Parameters (entry):
n - A specific line number, or
-n - Lines from bottom of screen, or
'm' - Screen midpoint, or
'm' +n - Screen midpoint plus n lines, or
'm' -n - Screen midpoint minus n lines.
Returns - A real line number
CheckLine - This subroutine is called to reset a
variable (@Offset) to zero when a new screen
line is defined. The @Offset variable
contains the number of attribute bytes
associated with this line that are placed in
the text definition of the screen.
Checkline is used to ensure that fields are
properly positioned on the screen.
Parameters (entry) - The current real line
number.