|Introduction||Creating and Maintaining Tools||Loading and Unloading Tools||Behind the Scenes|
When you launch Comet98, a default tool context is loaded. These are the "initial tools" and they include a pop-up menu (File, Edit, View, and Help), four icons, and two accelerators (Ctrl+N and Ctrl+P).
The SNOVA Progam
There are several ways to change the tool context. One way is to use the SNOVA program (found on the REL directory). This program is intended primarily for demonstration purposes, and operates as follows:
Comet will attempt to load a tool context named SYSTEM, which contains a popup structure with all of the Comet Utility programs and a toolbar with several popular utilities. The SYSTEM tool context looks like this:
The CTOOL Program
Your MTB programs can change the tool context at any time by using a subprogram supplied by Signature Systems. This program is CTOOL (found on the REL directory).
The CTOOL subprogram provides several options. If you want to switch to a new tool context, you can either LOAD the context or PUSH it. The LOAD option does not affect the tool stack, while the PUSH option does. The PUSH option places the tool context name on the top of the tool stack and pushes any previous tool context names one level down on the stack.
There are three options for removing a tool context: DESTROY, POP, and POPALL. The DESTORY option does not affect the tool stack. The POP option removes the top tool context from the stack and retores the previous context. The POPALL option removes all of the tool contexts from the stack and restores the initial tools.
The INQUIRE option provides a way to determine the name of the current tool context.
The interface to the CTOOL program is very simple. It consists of two parameters:
Your program should write these parameters to to the system buffer (in MTB terms, the LUN named #), then ENTER the CTOOL subprogram. The following program segment demonstrates the point.
LENGTH 1 & LOCAL ACTION$ ! action code is 1 character LENGTH 6 & LOCAL TOOLFILE$ ! tool context is 6 characters max. TOOL: FORMAT ACTION$;TOOLFILE$ ! format for the system buffer ACTION$ = ___ ! set the action code TOOLFILE$ = _____________ ! specify the tool context name PRINT (#,TOOL) ! write the info. to the buffer ENTER "CTOOL" ! enter the CTOOL subprogram
Here are the action codes supported by the CTOOL program. In these examples, the example tool context is named SAMPLE and the assumed format statement label is named TOOL.
|Action Code||Description||Program segement|
|L||Load a tool context and invoke the associated tools. Do not add this context to the tool stack.||
ACTION$ = "L" TOOLFILE$ = "SAMPLE" PRINT (#,TOOL) ENTER "CTOOL"
|D||Destroy the current tool context. Restore the initial tools. Do not pop the tool stack. (This action does not require a tool context name.)||
ACTION$ = "D" PRINT (#,TOOL) ENTER "CTOOL"
|P||Push the specified tool context onto the tool stack and invoke the associated tools.||
ACTION$ = "P" TOOLFILE$ = "SAMPLE" PRINT (#,TOOL) ENTER "CTOOL"
|O||Pop the top tool context from the stack and restore the previous tool context. If the stack is empty, or becomes empty as a result of this action, restore the initial tools. (This action does not require a tool context name.)||
ACTION$ = "O" PRINT (#,TOOL) ENTER "CTOOL"
|A||Pop all of the tool contexts from the tool stack. Restore the initial tools. (This action does not require a tool context name.)||
ACTION$ = "A" PRINT (#,TOOL) ENTER "CTOOL"
|I||Inquire. This action returns the name of the current tool context via the system buffer (in the sample program, the 6-byte field named CURRENT$ contains the name of the current tool context).||
ACTION$ = "I" PRINT (#,TOOL) ENTER "CTOOL" INPUT (#) CURRENT$ PRINT (0) "Current tool:";CURRENT$