The Genstat resource language can be used to design the layout and contents of custom dialogs within Genstat for Windows. A dialog is a user-interface object (menu) 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 are supplied within a Genstat resource file and are dynamically loaded at run-time.
Commands for layout for a dialog
To write your own dialog, you start by giving a DIALOG statement, this is followed by a CAPTION statement for the title of the dialog and a PROCEDURE statement to identify the procedure that is to be run from the dialog. The controls that appear on the dialog are then included between a BEGIN and END statement (see below).
DIALOG id, width, height
CAPTION text
PROCEDURE text
BEGIN
…
… Controls …
…
END
DIALOG statement
The DIALOG statement defines the id of the dialog and the initial size. The statement requires two or three parameters depending on size of the dialog you specify.
Parameter 1 | |
id | A unique id for the dialog. This id must be used in the gad file when attaching to Genstat. |
Parameter 2 | |
size | The size of the dialog (SMALL, MEDIUM or LARGE). Note that all controls must be within this size. |
or Parameters 2 & 3 | |
width | The width of the dialog. Note that all controls must be within this range. |
height | The height of the dialog. Not that all controls must be within this range. |
CAPTION statement
This CAPTION statement has one parameter that specifies the title that will appear on the caption title of the dialog. The text must be within double quotes, e.g. “My Dialog Title”.
PROCEDURE statement
This has one parameter that specifies the name of the procedure that will be called when the dialog is run. The name of the procedure must be within double quotes and must match the name of the procedure that it uses within Genstat. The procedure name can be up to 32 characters with the same rules as for the identifiers of data structures: the first character must be a letter and the second to the 32nd can be either letters or digits.
BEGIN and END statement
These statements have no parameters and are used to indicate the start and end of the controls that are added to the dialog.
Dialog Controls
The dialog controls are the objects that user interacts with. Genstat custom menus support the following controls:
Statement | Dialog Control |
PUSHBUTTON | Push button |
IMAGEBUTTON | Image button |
CHECKBOX | Check box |
TOGGLEBOX | Check box |
RADIOBUTTON | Radio Button |
LTEXT | Static text |
GROUPBOX | Group box |
EDITTEXT | Edit control |
COMBOBOX | Combination (combo) box |
LISTBOX | List box |
By default, a dialog is created with a Run and Cancel button which are positioned at the bottom of the dialog. These can be reposition using the PUSHBUTTON statement.
Coordinates for dialog and controls
The coordinates, width and height of the dialog and its controls are specified in dialog units (DLUs). A DLU is based on the size of the dialog box font, normally 8-point MS Sans Serif. A horizontal DLU is the average width of the font divided by four. A vertical DLU is the average height of the font divided by eight.
Attaching Help
Help can be supplied for a dialog in either html (.htm or .html) or compiled Help file format (.chm). The Help file can be opened using a push button or image button control using the BS_HELP flag.
Examples
- Example 1 – Summary Statistics using existing procedure.
- Example 2 – Transformations using a user procedure.