Introduction

This chapter describes the functions and calling sequences of user-written spawn routines used with the menu driver. These routines, which are used for implementing non-standard operator-interface functions, are called by the menu driver. (Refer to Menu Driver for more information on the menu driver in general, and on spawn routines in particular.)

NOTE: Unlike the routines described in Database Management Library Programs and Routines in the AIM Base Package, the routines described here are written by the system customizer and called by the AIM system.

Each routine is presented on a separate page, in alphabetical order. The "dictionary page" for each routine contains the following sections, as applicable:

Program Parameters

The formats of the calls to menu spawn routines are established within the AIM system and cannot be changed by the system customizer. To be compatible with the subroutine call, the first line of the spawn routine must have the format shown in this section.

NOTE: The routine name, and the variable names used for the routine parameters, are for explanation purposes only. Your spawn routine can use any (unique) routine name and any variable names you want.

Function

This is a brief statement of the function of the routine.

Usage Considerations

This section is used to point out special considerations associated with the routine.

Routine Name

This represents the user-defined name of the menu spawn routine. This name must exactly match the name specified for the related menu item.

As with all V+ program names, this name must: begin with a letter; can be one to fifteen characters long; and consist of only letters, numbers, and period (".") and underbar ("_") characters.

Input Parameters

Each of the input parameters in the calling sequence is described in detail. The routine should not modify any of the input parameters.

Output Parameters

Each of the output parameters in the calling sequence is described in detail. The spawn routine must set the output parameters as described.

Details

A description of the routine and its use is given.

 

 

Program Parameters

.PROGRAM menu.but.spawn (arg, db.p, $cmd)

 

Function

Respond to activation of a menu spawn-routine button. See Creating Menu Buttons.

Usage Considerations

The routine menu.but.spawn( ) is not provided with the AIM system. This documentation describes the calling sequence for menu "button" spawn routines, which must be written by the system customizer.

There can be as many "button" spawn routines as desired. The actual names for such routines are established by the system customizer, but the calling sequence must be as described here.

None of the input parameters should be modified by the routine.

When a spawn routine needs to access the menu window, it can do so by referencing logical unit number io.lun. However, user routines should never alter which window is open on this logical unit (that is, routines should never perform FCLOSE or FOPEN operations on this logical unit).

User routines should never access logical unit number io.lun2, which is used by the menu driver for the main menu window.

Routine Name

User Defined The name you choose for this spawn routine must match the one specified in the menu page item. Additionally, the parameter list must match the number and type of the parameters listed above, although you can use any variable names you wish. You can create as many different spawn routines of this type as needed.

Input Parameters

arg Specifies the value of the routine argument defined in the button menu record. This value is not used by the menu driver; it is passed to the spawn routine to help differentiate which button was selected.

db.p Specifies the number of the primary database in effect for the current menu page. All record-oriented operations (for example, delete record and append record) are directed to the primary database. Also, any menu items that reference a database, but do not have a database specified, use the primary database number.

Output Parameters

$cmd Contains the ky.spawn or ky.m.spawn command that initiated the menu spawn routine. The command is stored in the standard format for I/O communications buffers.

$cmd String variable that contains an error message or a new command to be processed by the menu driver. In either case, the value is returned in the standard format for I/O communications buffers.

If an error is returned, the qualifier of the communications buffer must contain the error code. In this situation, the error will be displayed by the menu driver, after which the original menu page will be redrawn automatically.

If a command is to be processed on completion of the spawn routine, the communications buffer must contain the command, stored in the standard I/O buffer format. Some typical commands that are returned by this type of routine are as follows:
Command
Interpretation
ky.refresh
Update any fields marked as auto refresh
ky.redraw
Redraw the displayed menu page and re-evaluate any conditional format
ky.exit
ky.yes
ky.no
Terminate execution of the current menu page, pop the menu stack, and continue execution of the next higher-level menu (etc.)
ky.menu Display and execute the menu page that is specified in this communications buffer

If no operation is to be performed on exit, and no error occurred, the qualifier of the communications buffer should be set to 0. See Menu Driver Application Notes for complete details on the $cmd communications buffer.

Details

This type of spawn routine is called by the menu driver when the operator activates a menu spawn-routine button. These spawn routines can be utilized to implement special functions that are not supported by the menu driver. Often, these routines perform a simple function, do not generate any output to the operator, and quickly return control to the menu driver. At other times, these spawn routines provide a means for major software packages to take over full control of the operator interface.

When this type of routine begins execution, the menu page that contained the spawn-routine button will be displayed in a screen window that is opened on logical unit number (LUN) io.lun. The spawn routine is free to write to this window. However, the spawn routine should not alter which window is opened on this LUN, as this may affect the operation of the menu driver when the spawn routine terminates execution.

When a button spawn routine exits, it returns a standard I/O communications buffer. The communications buffer can contain an error code that will be interpreted and displayed by the menu driver. Alternately, the communications buffer can contain any standard menu-driver command, which will subsequently be interpreted and executed by the menu driver.

 

 

Program Parameters

.PROGRAM menu.chk.spawn (arg, mode, db.p, type, db[], vals[], $stg, $cmd)

 

Function

Respond to a request from the menu driver to verify that the value of a data field can be modified. See Accessing a Database, AIM Variable, V+ Variable, or ai.ctl[ ] Numeric Value, Accessing a Database, V+ Variable, or $ai.ctl[ ] String Value, and Accessing a Location or Date/Time Value.

Usage Considerations

The routine menu.chk.spawn( ) is not provided with the AIM system. This documentation describes the calling sequence for menu "value_check" spawn routines, which must be written by the system customizer.

There can be as many "value_check" spawn routines as desired. The actual names for such routines are established by the system customizer, but the calling sequence must be as described here.

None of the input parameters should be modified by the routine.

When a spawn routine needs to access the menu window, it can do so by referencing logical unit number io.lun. However, user routines should never alter which window is open on this logical unit (that is, routines should never perform FCLOSE or FOPEN operations on this logical unit).

User routines should never access logical unit number io.lun2, which is used by the menu driver for the main menu window.

Routine Name

User Defined The name you choose for this spawn routine must match the one specified in the menu page item. Additionally, the parameter list must match the number and type of the parameters listed above, although you can use any variable names you wish. You can create as many different spawn routines of this type as needed.

Input Parameters

arg Specifies the value of the "routine argument" defined in the data-editing menu record. This value is not used by the menu driver: It is passed to the spawn routine to help differentiate which data field is being modified.

mode Specifies the action to be taken as follows:

0 A new value has been entered. The spawn routine must validate the new value and return an indication of whether or not the new value is acceptable.

1 The value of the field is to be deleted. The spawn routine must verify that the value can be deleted.

2 A new value has been entered; custom formatting is enabled. Occurs only if Check before display is indicated for this field in the menu page field definition.

3 A new value is about to be displayed; custom formatting is enabled. Occurs only if Check before display is indicated for this field in the menu page field definition.

10 The value has been double-clicked or a Go To (F3) has been received. The spawn routine can execute any required special processing or allow the menu driver to perform the standard processing of this event.

11 A Display (F5) command has been received. The spawn routine can execute any required special processing or allow the menu driver to perform the standard processing of this event.

db.p Specifies the number of the primary database in effect for the current menu page. All record-oriented operations (for example, delete record and append record) are directed to the primary database. Also, any menu items that reference a database, but do not have a database specified, use the primary database number.

type Specifies the type of data field that is being accessed. The possible values are as follows:
Value
Interpretation
mu.ty.bsig
Digital signal
mu.ty.cval
Scalar number
mu.ty.cstg
String
mu.ty.trans
Transformation
mu.ty.date
Date/time

db[ ] Real array that contains information that defines the database field or system control value that is being accessed.

If an AIM variable is being accessed, this array contains the following information:

db[0] -2
db[1] 0
db[2] AIM variable argument code
db[3] Bit number (0 = not a bit field, 1 = LSB, etc.)
db[4] Current menu database number

In this case, the variable can be accessed by calling the routines va.get.value( ) or va.put.num( ).

If a database field is being accessed, this array contains the following information:

db[0] Database number (1 to n)
db[1] Field number (0 to m)
db[2] Array index (0 to p)
db[3] Bit number (0 = not a bit field, 1 = LSB, etc.)
db[4] Current menu database number

If a V+ variable is being accessed, this array contains the following information:

db[0] -1
db[1] 0
db[2] 0
db[3] Bit number (0= not a bit field, 1= LSB, etc.)
db[4] Current menu database number. In this case, the name of
the V+ variable may be determined with mu.get.vname( ).

If a system control value (ai.ctl[ ] or $ai.ctl[ ]) is being accessed, this array contains the following:

db[0] 0
db[1] 0
db[2] Index for either ai.ctl[ ] or $ai.ctl[ ]
db[3] Bit number (0 = not a bit field, 1 = LSB, etc.)
db[4] Current menu database number.

vals[ ] Real array that contains the new value(s) to be written. Depending upon the type parameter, this array contains the following values (only for mode 0):
Type
Contents
Digital signal
vals[0] contains TRUE or FALSE
Scalar number
vals[0] contains new value
String
vals[0] contains 0
Transformation
vals[0] through vals[5] contain the DECOMPOSEd components of the transformation
Date/time
vals[0] contains the date and vals[1] contains the time, in the format returned by the real-valued function TIME( )

In mode 1, for completeness, all of the elements of vals[ ] are set to zero.

$stg Contains the new value of the string if the type is mu.ty.cstg (mode 0 only). For all other data types, the value of this string is null.

In mode 0: For string data types (type is mu.ty.cstg), this contains the new value of the string. Otherwise, this is an empty string.

In mode 2: This contains the raw ASCII data received for input. In all other modes, this is an empty string.

$cmd Contains the command that was received, in the standard format for I/O communications buffers (valid only for modes 10 and 11).

Output Parameters

For mode 0, the output parameters are as follows:

vals[ ] Real array whose input values are modified to reflect the actual values to be written. The spawn routine can modify the input values if desired, and the modified values will be written and displayed. This array is valid only if no error is indicated and the data type is not mu.ty.cstg.

$stg String variable whose input value is modified to reflect the actual value to be written. The spawn routine can modify the input value if desired, and the modified value will be written and displayed. This string value is valid only if no error is indicated and the data type is mu.ty.cstg.

$cmd String variable that returns an error message in the standard format for I/O communications buffers. If the value contained in vals[ ] or $stg is valid, the qualifier of the I/O buffer must be greater than or equal to zero. Otherwise, if the value is invalid, the qualifier must contain an error code.

For mode 1, the output parameter is as follows:

$cmd String variable that returns an error message in the standard format for I/O communications buffers. If deleting is permitted, the qualifier for the buffer should be zero. Otherwise, the qualifier should be set to an error code.

For mode 2, the output parameters are as follows:

$cmd Command I/O buffer that contains either a 0 for the qualifier, to indicate that the input should be accepted, or an error code if the input is not accepted.

$stg The ASCII data to be processed according to the indicated field type.

For mode 3, the output parameters are as follows:

$cmd Command I/O buffer that contains either a 0 for the qualifier, to indicate that the field should be displayed normally, or an error code if the field should not be displayed at all.

$stg If a 0 qualifier is returned in $cmd, and if, and only if, $stg is not null, $stg is used as the display for the field. If the field type is an icon, $stg is used as the name of the icon and vals[0] is used as the icon index.

vals[ ] If $stg is null, vals[ ] contains the value to be formatted and displayed according to the format specified in the record.

For modes 10 and 11, the output parameter is as follows:

$cmd String variable that returns a command or error message. If the menu driver is to process the double-click or Go To (F3) in the usual fashion, the value of $cmd should not be changed from its input value. Otherwise, the output value should be a menu command or error, in the standard format for an I/O communications buffer. See Menu Driver Application Notes for complete details on the $cmd communications buffer.

Details

This type of spawn routine is associated with a data field that allows write access to a database value, a global control value, or a digital output signal. The spawn routine permits application programs to perform special range checking and operations each time a new value is entered for a data field.

A value check routine can be specified for every menu database record that allows read or write access to a database value, a global control value, or a binary output signal. This check routine is called in the following circumstances:

1. Before the value is displayed on the menu page. The check routine may check the value and indicate an error or it may change (or set) the value to be displayed. It may allow the menu driver to display the value using the format indicated by the field, or it may display the value using a custom format.

2. After the value has been edited by the operator, but before the menu driver has examined the ASCII input data. The routine may modify the ASCII input which is then processed according to the specified format.

3. After the value has been edited by the operator and verified for proper format and range by the menu driver. If the check routine returns an indication that the value is acceptable, the new value will be written by the menu driver. If the check routine returns an error code, the corresponding error message will be displayed as a pop-up.

4. When the associated data field is selected and a double-click event, a GOTO key press, or a display selection key press is issued. The check routine is called before the menu driver processes the key press. This allows the check routine to intercept the event and perform an alternate operation if desired.

The description of mode mu.rf.refresh in the Output Parameters section for the menu spawn routine menu.pag.spawn( ) now contains some additional information. Below is the corrected documentation.

 

 

Program Parameters

.PROGRAM menu.cnd.spawn (arg, db.p, draw)

 

Function

Respond to a request from the menu driver to define the state of a menu page conditional section. See Creating a Conditional Section.

Usage Considerations

The routine menu.cnd.spawn( ) is not provided with the AIM system. This documentation describes the calling sequence for menu "conditional" spawn routines, which must be written by the system customizer.

There can be as many "conditional" spawn routines as desired. The actual names for such routines are established by the system customizer, but the calling sequence must be as described here.

None of the input parameters should be modified by the routine.

When a spawn routine needs to access the menu window, it can do so by referencing logical unit number io.lun. However, user routines should never alter which window is open on this logical unit (that is, routines should never perform FCLOSE or FOPEN operations on this logical unit).

User routines should never access logical unit number io.lun2, which is used by the menu driver for the main menu window.

Routine Name

User Defined The name you choose for this spawn routine must match the one specified in the menu page item. Additionally, the parameter list must match the number and type of the parameters listed above, although you can use any variable names you wish. You can create as many different spawn routines of this type as needed.

Input Parameters

arg Specifies the value of the "routine argument" defined in the conditional menu record. This value is not used by the menu driver, but is passed to the spawn routine to help differentiate which conditional test is to be performed.

db.p Specifies the number of the primary database in effect for the current menu page. All record-oriented operations (for example, delete record and append record) are directed to the primary database. Also, any menu items that reference a database, but do not have a database specified, use the primary database number.

Output Parameters

draw Real variable that receives the value TRUE if the menu items within the conditional section should be displayed. Otherwise, the value FALSE is returned.

Details

This type of spawn routine is called by the menu driver when a conditional menu record is encountered whose state is dependent upon the result returned by a spawn routine. This type of spawn routine can be utilized to evaluate conditional display requirements that are more complicated than the simple equality tests that can be performed automatically by the menu driver.

The spawn routine will be called when the menu page is first drawn, and each time that it is redrawn (assuming that the conditional record is not ignored due to a higher-priority conditional being FALSE).

 

 

Program Parameters

.PROGRAM menu.pag.spawn (arg, mode, db.p, lun, luns[], $cmd)

 

Function

Respond to a request from the menu driver for any special processing desired for a menu page. See the The Menu Page Header.

Usage Considerations

The routine menu.pag.spawn( ) is not provided with the AIM system. This documentation describes the calling sequence for menu-page spawn routines, which must be written by the system customizer.

There can be as many "page" spawn routines as desired. The actual names for such routines are established by the system customizer, but the calling sequence must be as described here.

None of the input parameters should be modified by the routine.

When a spawn routine needs to access the menu window, it can do so by referencing logical unit number io.lun. However, user routines should never alter which window is open on this logical unit (that is, routines should never perform FCLOSE or FOPEN operations on this logical unit).

User routines should never access logical unit number io.lun2, which is used by the menu driver for the main menu window.

Routine Name

User Defined The name you choose for this spawn routine must match the one specified in the menu page item. Additionally, the parameter list must match the number and type of the parameters listed above, although you can use any variable names you wish. You can create as many different spawn routines of this type as needed.

Input Parameters

arg Specifies the value of the "routine argument" defined in the page header menu record. This value is not used by the menu driver; it is passed to the spawn routine to help differentiate which menu page is being processed.

mode Specifies the menu processing mode, as follows:
mode
Interpretation
mu.rf.first
The menu page has just been selected and is being drawn for the first time. The page spawn routine is called after the page header record has been opened and before any other processing for the menu page is performed. This call to the page routine will be followed by a call with mode mu.rf.redraw.
mu.rf.redraw
The menu page is about to be completely drawn or redrawn. A full redraw occurs when the menu page is first invoked; the Redraw (Shift+F6) key is pressed; a field value is edited and a redraw is requested; another menu spawn routine has requested a redraw; processing of the menu page is being resumed after the completion of another menu page that was invoked from this page; or a different record is selected in the primary database being edited.
The page routine is called after the window has been created or cleared, but before any menu records (other than the page header) are processed.
mu.rf.refresh
The auto-refresh fields of a page are about to be sampled for refresh. The page routine is called before any values are sampled.
mu.rf.lun.io
Input has been received on an auxiliary LUN that is being scanned. The received input is passed to this routine and not processed by the menu driver.
mu.rf.nxt.menu
A new menu page (possibly a pop-up) has been invoked; processing of the current page is being suspended. The page routine will be called later, either with mode mu.rf.redraw to indicate that processing of the page has resumed, or mode mu.rf.exit to indicate that the processing of the page is being terminated.
mu.rf.spw.str
Control is being passed to a button spawn routine, and so processing of the menu page is being suspended.
mu.rf.spw.end
The button spawn routine has completed execution and processing of the menu page is being resumed.
mu.rf.rec.opr
A record operation has been invoked (for example, delete database record or move to next record). If this command is ignored, the menu driver will process the record operation in the normal manner. Otherwise, the page routine can take whatever action is required and return an alternate command.
mu.rf.exit
Processing of the current menu page is being terminated.

db.p Specifies the number of the primary database in effect for the current menu page. All record-oriented operations (for example, delete record and append record) are directed to the primary database. Also, any menu items that reference a database, but do not have a database specified, use the primary database number.

This value is always 0 for mode mu.rf.first, since the primary database is not established at the time this routine is called.

lun Specifies the number of the logical unit on which input was received (valid only in mode mu.rf.lun.io).

$cmd String value, variable, or expression that contains an input event or command in the standard format for I/O communications buffers.

The value of this parameter is interpreted as a function of the mode parameter, as follows:
mode
Interpretation of $cmd
mu.rf.lun.io
The buffer contains the input event that was received on the LUN. The event type is contained in the buffer qualifier, and the event parameters are stored in io.int1, io.int2, and io.int3 in the buffer data section.
mu.rf.rec.opr
The buffer contains one of the following commands:
ky.back ky.index ky.previous
ky.copy.rec ky.last ky.repeat
ky.cut.rec ky.new ky.retrieve
ky.first ky.next ky.search
ky.paste.rec ky.search.fail
mu.rf.refresh
The buffer is initialized to the value $io.cmd.nop as a convenience.
(all others)
Not used.

Output Parameters

For mode mu.rf.redraw, the output parameter is as follows:

luns[ ] Real array that contains a list of auxiliary LUNs that the menu driver is to scan for input. The number of auxiliary LUNs to scan is in luns[0]. The auxiliary LUN numbers are stored in sequential elements starting with luns[2] (not element #1). Element zero is initialized to 0 by the menu driver. Up to nine LUNs can be specified.

NOTE: The menu driver uses logical unit io.lun for all of its window operations and logical unit io.lun2 for the main pulldown window. Thus, these logical units should never be specified as auxiliary logical units.

For mode mu.rf.lun.io, the output parameter is as follows:

$cmd String variable that returns a command, in the standard format for I/O communications buffers. This command is generated by the spawn routine in response to input received from the auxiliary LUN, and is processed by the menu driver when this routine exits. If no action is to be taken, the buffer qualifier should be set to zero. While this command buffer can contain a window event command (mouse down, etc.), normally one of the following key-press commands is returned:

ky.exit Exit menu page

ky.redraw Redraw menu page

ky.refresh Update auto-refresh values

For mode mu.rf.refresh, the output parameter is as follows:

$cmd String variable that returns a command or error message in the standard format for I/O communications buffers. If no special function is to be performed following the refresh operation, this parameter should be unchanged from its initial value of $io.cmd.nop. Otherwise, this can contain any command that you wish to have executed. As with mode mu.rf.lun.io, the most likely commands returned are ky.redraw or ky.exit.

NOTE: You cannot set the qualifier of $cmd to the value of an error number to return an error (negative command code).

For mode mu.rf.rec.opr, the output parameter is as follows:

$cmd String variable that returns a command or error message in the standard format for I/O communications buffers. If the menu driver is to process the record operation in the normal fashion, this parameter should be unchanged from its input value. Otherwise, $cmd should contain a menu command or error in the standard I/O communications buffer format. If the record operation is to be ignored, the buffer qualifier should be set to zero.

Details

A menu-page spawn routine is specified in the header record for a menu page and is called whenever the page is drawn or an operation is performed that has an effect on the entire page. This type of routine can be used to precompute values referenced by the page, write additional information in the menu window, intercept and change the meaning of record-oriented operations, or service input from auxiliary LUNs.

For menu pages that include a page routine, this spawn routine will be called under the following circumstances:

1. Just before the page is fully drawn or redrawn.

2. Just before the auto-refresh values of the page are updated.

3. If input is received on an auxiliary LUN.

4. When processing of the menu page is being terminated.

5. Just before a record operation is to be performed (delete record, create record, next record, etc.).

 

 

Program Parameters

.PROGRAM menu.pnl.spawn (arg, mode, db.p, x, y, dx, dy $cmd)

 

Function

Respond to a request from the menu driver for any special processing desired for a panel (or rectangle) on a menu page, including special handling of input events that occur when the panel (or rectangle) is selected. See Creating Static Items.

Usage Considerations

The routine menu.pnl.spawn( ) is not provided with the AIM system. This documentation describes the calling sequence for menu "panel" spawn routines, which must be written by the system customizer.

There can be as many "panel" spawn routines as desired. The actual names for such routines are established by the system customizer, but the calling sequence must be as described here.

None of the input parameters should be modified by the routine.

When a spawn routine needs to access the menu window, it can do so by referencing logical unit number io.lun. However, user routines should never alter which window is open on this logical unit (that is, routines should never perform FCLOSE or FOPEN operations on this logical unit).

User routines should never access logical unit number io.lun2, which is used by the menu driver for the main menu window.

Routine Name

User Defined The name you choose for this spawn routine must match the one specified in the menu page item. Additionally, the parameter list must match the number and type of the parameters listed above, although you can use any variable names you wish. You can create as many different spawn routines of this type as needed.

Input Parameters

arg Specifies the value of the "routine argument" defined in the panel (or rectangle) menu record. This value is not used by the menu driver, but is passed to the spawn routine to help differentiate which panel (or rectangle) is being processed.

mode Specifies the action to be taken as follows:

0 The window is being completely drawn. The spawn routine is being notified of the window coordinates of the panel (or rectangle).

1 Either the panel (or rectangle) has been selected, or a mouse or key-press event has occurred within the window. The spawn routine is being passed the selection notification or event so that it can perform whatever processing is required.

db.p Specifies the number of the primary database in effect for the current menu page. All record-oriented operations (for example, delete record and append record) are directed to the primary database. Also, any menu items that reference a database, but do not have a database specified, use the primary database number.

x, y, dx, dy Specify the coordinates of the panel (or rectangle) defined by the menu record. The x and y values are coordinates of the upper left-hand corner of the panel (or rectangle), and the dx and dy values are the width and height, respectively, of the panel (or rectangle). All the values are in pixels. In mode 1, these values are all zeros.

Normally, the graphics generated by this routine are drawn within this rectangle, but graphics may be drawn anywhere in the window.

$cmd Contains the key press or mouse command that was received, in the standard format for I/O communications buffers (valid only for mode 1). The following are possible qualifiers of the command:

ky.b.tab ky.display ky.f.up

ky.but.down ky.down ky.goto

ky.but.move ky.f.down ky.return

ky.but.up ky.f.left ky.tab

ky.dbl.clk ky.f.right ky.up

Use INTB($cmd, io.qal) to extract the qualifier.

Output Parameters

$cmd String variable that returns a command or error message, in the standard format for I/O communications buffers (this parameter is ignored in mode 0). This command is processed by the menu driver when this routine exits. If no operation is to be performed, the qualifier should be set to 0. If an error is to be reported by the menu driver, the qualifier should contain the error code. See Menu Driver Application Notes for complete details on the $cmd communications buffer.

Details

This type of spawn routine is associated with a menu record that draws a panel (or a rectangle). This spawn routine permits application software to detect how a panel (or rectangle) is positioned and sized, and to intercept all mouse events that occur within the panel (or rectangle).

When the panel (or rectangle) is drawn, this routine is called with the position and dimensions of the panel (or rectangle). This allows customized graphics to be drawn in a window location determined by the standard menu editor.

While the panel (or rectangle) is displayed, any key presses that select the panel (or rectangle) or any mouse events within the panel (or rectangle) are sent to this routine.

Application programs can output to the window using standard V+ graphics instructions that are directed to the logical unit io.lun. When this spawn routine is called, the logical operation is set to "source", and the texture mode and pattern are set to "transparent" and "solid", respectively. If these settings are changed, they must be restored to these initial values before the routine returns. The initial color values are not initialized, may be freely changed, and do not need to be restored.

 

 

Program Parameters

.PROGRAM menu.scr.spawn (arg, mode, db.p, line, n.line, $line, $cmd)

 

Function

Respond to a request from the menu driver for any special processing desired for a scrolling-text window. See Creating a Scrolling Window.

Usage Considerations

The routine menu.scr.spawn( ) is not provided with the AIM system. This documentation describes the calling sequence for menu "scrolling-text" spawn routines, which must be written by the system customizer.

There can be as many "scrolling-text" spawn routines as desired. The actual names for such routines are established by the system customizer, but the calling sequence must be as described here.

None of the input parameters should be modified by the routine.

When a spawn routine needs to access the menu window, it can do so by referencing logical unit number io.lun. However, user routines should never alter which window is open on this logical unit (that is, routines should never perform FCLOSE or FOPEN operations on this logical unit).

User routines should never access logical unit number io.lun2, which is used by the menu driver for the main menu window.

Routine Name

User Defined The name you choose for this spawn routine must match the one specified in the menu page item. Additionally, the parameter list must match the number and type of the parameters listed above, although you can use any variable names you wish. You can create as many different spawn routines of this type as needed.

Input Parameters

arg Specifies the value of the "routine argument" defined in the scrolling window menu record. This value is not used by the menu driver, but is passed to the spawn routine to help differentiate which scrolling window is being processed.

mode Specifies the action to be taken as follows:

0 The window is being completely drawn. The spawn routine must return the total number of text lines and the number of the selected line.

1 A line of text is being displayed. The spawn routine must return the contents of the line.

2 The selected line has been changed. The spawn routine is receiving notification of this event. If there are no lines to select, this mode will not be generated.

Immediately after the spawn routine is called in mode 2, it will be executed again in mode 1 to allow the selected line to be redrawn. Also, formerly, if a line was already selected and the operator clicked on the same line, the spawn routine was not executed. However, this was changed in 3.0, and the spawn routine is executed in mode 2, even if the line was formerly selected.

10 Double click or Go To (F3) was received in the scrolling window. This command can be generated even if there are no lines defined in the scrolling window.

11 A Display (F5) command was received in the scrolling window. This command can be generated even if there are no lines defined in the scrolling window.

db.p Specifies the number of the primary database in effect for the current menu page. All record-oriented operations (for example, delete record and append record) are directed to the primary database. Also, any menu items that reference a database, but do not have a database specified, use the primary database number.

line Real value, variable, or expression that is interpreted based upon the value of mode as follows:
mode
Interpretation of line
0
Not used as an input parameter
1
Number of the line being displayed (1 to n)
2
Number of the line being selected (1 to n)
10 or 11
Number of the line currently selected (0 to n)

$cmd String value, variable or expression that contains the command that was received, in the standard format for I/O communications buffers (valid only for mode 10 and mode 11).

Output Parameters

For mode 0, the output parameters are as follows:

line Real variable that returns the number of the first selected line (0 to n). Zero should be returned only if the scrolling window does not contain any lines of text.

n.line Real variable that returns the total number of lines that can be displayed (0 to n).

For mode 1, the output parameters are as follows:

$line String variable that returns the contents of the line to be displayed.

$cmd String variable that returns an error message, in the standard format for I/O communications buffers. The qualifier of the buffer should be greater than or equal to zero if no error occurred in creating the text line. Otherwise, the qualifier should be set to an error code.

If the qualifier is ky.color, the qualifier is followed by a value that specifies the color to be used to draw the text returned in $line.

The color standards are:

io.col.cmplx (blue) Indicates a complex item or label for a list of items (e.g., used for directory file names or labels above groups of radio buttons).

io.col.err (red) Highlights an error message.

io.col.hilgt (maroon) Highlights a selected item (e.g., selected item in the motion tweek pop-up).

For mode 2, there are no output parameters.

For mode 10 and mode 11, the output parameter is as follows:

$cmd String variable that returns a command or error message, in the standard format for I/O communications buffers. If the menu driver is to process the double click or Go To (F3) in the usual fashion, the value of $cmd should be unchanged from its input value. Otherwise, this parameter should contain a menu command or error in the standard format for I/O communications buffers. See Menu Driver Application Notes for complete details on the $cmd communications buffer.

Details

This type of spawn routine is called by the menu driver in connection with a menu record for a scrolling-text window. This type of spawn routine performs the following functions:

1. When the window is first drawn, the spawn routine specifies the number of text lines that exist and defines the number of the first selected line.

2. When the window is first drawn and each time it is scrolled, this routine supplies the lines of text that are displayed in the window.

3. Each time a new selected line is specified by the operator, this routine receives notification of the new selected line.

4. Each time a double click, Go To (F3) or Display (F5) command is received in the scrolling window, this routine receives notification of the event before the menu driver processes the event. This allows the user routine to intercept the event and perform an alternate operation, if desired.

While this routine is responsible for supplying all of the text information, the menu driver is responsible for displaying the information and controlling the highlighting to indicate the selected line.