1. Home
  2. Custom dialogs

Custom dialogs

A custom dialog add-in is a window that is created using the Genstat resource language that is loaded at run time. A dialog is a user-interface object (window) that presents information and allows users to change the information. It can contain one or more controls (child windows) with which the user enters text, chooses options, or directs the action.

In Genstat a custom dialog can be used to retrieve data from the controls, and the data can then be used within an attached Genstat procedure. The resource language commands for the dialogs are supplied within a Genstat resource file (*.grc) that is attached using a Genstat add-in file. A procedure that is to be used in conjunction with a dialog should be supplied within a procedure library in an add-in folder.

For details about designing dialogs see the Genstat resource language.

Attaching to Genstat

To attach a custom dialog 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 dialog, should be supplied using a subsection called Type. Each add-in needs to be supplied 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 name of the file containing the dialog resources should be entered using the subsection ResourceFile. The full path must be supplied with the resource filename, unless the resource file is contained same folder as the GAD file. The following example shows the layout of the GAD file that can be used to attach a dialog.

[AddIn1]
    Type=DIALOG
    ProgID=MYDIALOG
    ResourceFile=mymenu.grc

Dialogs 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 Dialogs.

[AddIn1]
    Type=DIALOG
    ProgID=MYDIALOG1
    MenuTitle=My Dialog 1
    ResourceFile=mymenu.grc
    Submenu=New Dialogs

[AddIn2]
    Type=DIALOG
    ProgID=MYDIALOG2
    MenuTitle=My Dialog 2
    ResourceFile=mymenu2.grc
    Submenu=New Dialogs

To make the add-ins accessible from Genstat you must create the GAD file 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, you must 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, you can place the file within the user add-in folder. The location of the user add-in folder is controlled via the workspace tab within the options.

See Also

Updated on November 9, 2017

Was this article helpful?