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.2 @Control Panel Driver Routine
9.4.2.1.2 @Control Panel Driver Routine
The @Control routine displays screens and reads the input.
If no errors are encountered by @ScreenFormat in processing
the main menu screen, then @Control is called. It is passed
the name of the screen file and, after initialization, goes
into a loop that continues displaying and reading screens
until the user indicates that it is ready to exit.
When a screen is read, any RES tags (reserved fields) are
edited, and the PF or ENTER key is processed. If a PA2 key
tag is encountered, screen diagnostics are displayed.
SUBROUTINES
GetDataFields This is called any time a new screen is to
be displayed. This subroutine gets the data
fields for the screen by using CallFunction
with the GET parameter.
Parameters (entry) - Screen number
Returns - Value of 1 assigned to @ScreenINIT
variable to indicate initialization is
complete.
ScreenRefresh This is called to pass lines to XEDIT for
display. Loops through the variables
created by @ScreenFormat, and for each line
issues a SET RESERVED command. Once all of
the lines have been displayed, the Cursor is
positioned on the screen with the CURSOR
SCREEN command.
Parameters (entry) - Screen number; cursor
position.
PFKey This puts the pressed PFKey on the pending
action queue if the key is defined. The PFK
definitions for the current screen are
checked first. If a separate definition has
been established for this PFK, SetPendAct is
called with that a action. If no definition
was made, the screen 0 definitions are
checked next. If defined, SetPendAct is
then called with the appropriate action.
Finally, if no definition has been
established for the key, an error message is
issued by using the ErrMsg function.
Parameters (entry) - PFKey number; screen
number.
PAKey If PAKey 2 is pressed, screen diagnostics
are displayed, indicating the screen
displayed, and the action/edit function used
for processing the screen. Furthermore, as
each field is processed on the screen, the
field name and contents are displayed.
EnterKey No action is taken by this routine. The RES
tags are used to determine the action to
be taken.
EditField This is called when a RES tag is encountered
after a screen read. The subroutine parses
the tag data to determine the line and
column that were modified, and checks to see
if the field modified is a menu selection.
If so and the choice is valid, a NEWSCREEN
internal command is added to the pending
stack. If the data is not a menu selection,
the data is edited by using the CallFunction
function to edit the data.
CallFunction This calls an edit/action routine. In the
case of the VM data transfer program, this
amounts to calling profile VMTPARMS, which,
in turn, passes control to the appropriate
edit or action routine. If a zero return
code is received, then routine UpdateFields
is called. Regardless of the return code
value, routines DisplayMSG, AddAction, and
ModifyDisplay are then called in sequence.
Parameters (entry) - Screen name; function
name (EDIT, SAVE, GET, or ACTION); field
name; data value.
Returns - A zero return code indicates that
everything is O.K.; otherwise the return
code is non-zero.
UpdateFields This is called to update the field values
after successful completion of an
edit/action routine. The field names for
the screen are retrieved, and routine
InsData is called to put the data into a
line. InsData is assigned to a variable
only to invoke the function; the variable
created is not used.
InsData This is called by the subroutine
UpdateFields to move a new value into a data
field. The screen layout is modified with
the new data, and a "refresh line" flag is
set.
Parameters (entry) - Field name; field
value.
Returns - A return code of zero.
DisplayMSG Pulls queued messages off the message stack,
and displays them via XEDIT.
ErrMSG Calls external routine VMTMsg to read in
message text from the VMTMSGS ERRMSG * file.
ErrMSG then calls DisplayMsg to display the
message.
Parameters (entry) - Message number;
variable list for substitution.
Returns - Zero indicates that the message
severity level is I, W, or R. Otherwise,
the message number is returned.
AddAction If any actions have been added because of
processing done by CallFunction, AddAction
calls the SetPendAct routine to place the
action on the pending queue.
ModifyDisplay Performs no function at this time.
SetPendAct Updates the count of pending actions,
and adds an action to the pending action
queue.
Parameters (entry) - Name of Action to be
added. Possible values include: QUIT,
PQUIT, SAVE, FILE, PREVSCREEN, NEWSCREEN,
NESTSCREEN, ACTION, RELOAD, and HELP.
DoQUIT Called whenever the pending action is either
QUIT or PQUIT. The value returned is set to
1 if this is a PQUIT. It is also set to 1
if the action is a QUIT, and the current
screen is not screen 0 (the main menu). If
the QUIT message is issued from a nested
screen, routine DoPREVSCREEN is called.
Parameters (entry) - QUIT or PQUIT.
Returns - 1 or 0, indicating whether (1) or
not (0) to leave the VMTDSP routine.
DoSAVE Called whenever the pending action is a
SAVE or FILE. A CallFunction then saves the
data entered on the current screen. DoSAVE
returns a value of 1 when the pending action
is FILE and screen 0 is calling the current
screen. Otherwise, subroutine DoPREVSCREEN
is called.
DoPREVSCREEN Called to move up one level in terms of
screen nesting. The screen that called the
current screen is made the new current
screen, and the nesting level index is
adjusted by subtracting one from the screen
level number.
Returns - Previous screen name.
DoNESTSCREEN Called to display a new screen. This
subroutine is not used in setting VM data
transfer parameters at this time. If
called, it updates global nesting variables,
and invokes routine DoNEWSCREEN.
DoNEWSCREEN Called when a menu selection causes a new
screen to be displayed. If the screen has
not been previously entered during the
present session, subroutine ScreenFormat is
called to read in the screen and initialize
the necessary control variables. If no
errors are encountered, the new screen name
is returned. If errors are encountered,
appropriated error messages are formatted,
and current screen name is returned, thereby
causing that screen to be displayed again.
Parameters (entry) - New screen name.
Returns - New or current screen name.
DoACTION Called when a function specified in the
screen as an "action" is requested through a
PFkey. The CallFunction subroutine is
called with an ACTION parameter.
Parameters (entry) - The parameters to be
passed to the edit/action routine, such as
EDIT SELECT, or REFRESH.
DoHELP Called when the current pending action is a
request for help, usually invoked by the
user pressing the PF1 Key. The CMS command
HELP is issued with the parameters specified
for use with the PF1 key in the screen
definition of PFKeys.
Parameters (entry) - The PFKey Help
parameters.
DoRELOAD Called when the current pending action is a
RELOAD of the screen format information.
This subroutine is used for debugging
purposes to force a call to the
@ScreenFormat subroutine.
Diagnose Called by the EditField subroutine when
screen diagnostics are requested via the PA2
key. The subroutine issues a CMS command
MSG displaying the data for the screen as it
is processed by the EditField routine. It
bypasses the editing of the data entered on
the screen.