1. Home
  2. Procedure menus

Procedure menus

A procedure menu add-in is a procedure that has been written using the Genstat command language that includes commands that use windows menus. For example, this could be a procedure that has been written to include the QUESTION procedure. The procedure must be designed so that it can be called with no arguments and it should be attached via a procedure library. The example below shows a simple procedure that uses QUESTION to retrieve an identifier name and then prints this using the PRINT directive.

    PROCEDURE ‘MYPRINT’
    PARAMETER ‘DATA’
      MODE=p; SET=no

    IF (UNSET(DATA))
      QUESTION [PREAMBLE=‘Enter name of structure to print’; RESPONSE=resp]
      ASSIGN [SCOPE=global] resp[1];DATA
    ENDIF
    PRINT DATA
    ENDPROCEDURE

Attaching to Genstat

To attach a procedure menu add-in to Genstat you must supply the details within a Genstat add-in (GAD) file. Within the GAD file each add-in is specified in a separate section called [AddInX] where X is a number. If you have more than one add-in these can be specified in the same file (as AddIn1, AddIn2, etc…) or within separate files. The details of the add-in are then supplied using different subsections. For example, SUBSECTION = …details…

The type of add-in, in this case the procedure, should be supplied using a subsection called Type. Each add-in needs to be supplied in a unique ID using the ProgID subsection. This is required so that Genstat can easily distinguish between different add-ins. This can be supplied as a string of characters. The name that is to appear on the User menu should be supplied using the subsection MenuTitle. Finally the procedure name itself must be entered using the subsection Procedure. The following example shows the layout of the GAD file that can be used to attach the procedure MYPRINT (see above).

[AddIn1]
    Type=PROCEDURE
    ProgID=MyPrintProc1
    MenuTitle=Print Data Structure
    Procedure=MYPRINT

Procedure menus can be grouped together under a menu item using a Submenu subsection in the GAD file. The following example shows the layout that can be used to attach 2 dialogs under the same menu section called New Procedure Menus.

[AddIn1]
    Type=PROCEDURE
    ProgID=MyPrintProc1
    MenuTitle=My procedure 1
    Submenu=New Procedure Menus

[AddIn2]
    Type=PROCEDURE
    ProgID=MyPrintProc2
    MenuTitle=My procedure 2
    Submenu=New Procedure Menus

To make the add-ins accessible from Genstat the GAD file should be created using the file extension .gad. You should then place the file in either the system or user add-in directory. To make a custom menu add-in available system wide, i.e. to all users that have access to Genstat on a network server or on a local machine, place the file in the system add-in folder called AddIns within the Genstat installation. Alternatively, to make the custom menu add-in only available to the current user, place the file within the user add-in folder. The location of the user add-in folder is controlled by selecting Tools | Options then setting a file path in the User add-in folder field on the General tab.

See also

Updated on May 8, 2019

Was this article helpful?