1. Home
  2. Pushbutton controls (Genstat Resource Language)

Pushbutton controls (Genstat Resource Language)

The PUSHBUTTON Genstat resource-definition statement creates a push button control. The control is a round-cornered rectangle containing the given text where the text is centred in the control. Each push button must have an associated action flag which is activated when the user clicks on the button.

PUSHBUTTON text, id, x, y, width, height, flags [, helptext [, chmtext]]

The text that is displayed, centre justified, on the push button.

The id is a string used to identify controls within the resource file. If the control is to return a result to the attached Genstat procedure, this must use the same name as the procedures option or parameter that the result is for.

The flags for the push button can be one of the following:

BS_RUN Creates a Run button that activates the attached procedure and closes the dialog.
BS_CANCEL Creates a Cancel button that closes the dialog without saving any changes.
BS_CLEAR Creates a Clear button that Clears any edit controls.
BS_BROWSE Creates a Browse button that can be used to retrieve a filename.
BS_HELP Creates a Help button. When this is selected the helptext parameter must be set.
GW_SAVE This should be used with BS_BROWSE. When this is specified the Browse dialog will open a Save File dialog.

GW_SAVE (BS_BROWSE flag only)
When the GW_SAVE flag is specified along with the BS_BROWSE flag, clicking the Browse button will open a Save File dialog. This dialog lets you select a file and will warn if the specified file name already exists. By default (when no GW_SAVE flag is specified), clicking the Browse button produces the Open File dialog where a fault message will appear if the file does not exist.

helptext (BS_HELP flag only)
When the BS_HELP flag is set the helptext parameter is used to specify an html file or compiled Help file (chm) name that contains Help for the dialog. The filename must be specified in double quotes. If an html filename is specified the file will be opened using the user’s default browser. For a compiled Help (chm) file a topic within the file can be supplied using the chmtext parameter. If the Help file is stored in one of the add-in folders then you do not need to specify the path. Genstat will search for the file by first looking in the user add-in folder, then the system add-in folder. For Help files not stored in an add-in folder the full path and filename must be supplied.

chmtext (BS_HELP flag only)
If the helptext specifies a compiled Help file (chm) name then the chmfile parameter can be used to identify the topic within that helpfile. You must supply the topic name within double quotes. For example, if the topic is in a file called MYTOPIC.chm in the compiled Help file you can use “MYTOPIC.chm” to display that topic.

The following example demonstrates how to create a push button for a run button:

PUSHBUTTON “Run”, IDRUN, 10, 10, 40, 14, BS_RUN

The next example demonstrates how to create a Help push button to open an html file containing Help for the dialog. The Help file is assumed to be in one of the add-in folders:

PUSHBUTTON “Help”, IDHELP, 10, 10, 40, 14, BS_HELP, “dialoghelp.html”

The next example demonstrates how to create a browse button to select a file name that will be used by the corresponding procedure to save output or data:

LTEXT “&Output file:”,ISTATIC,2,80,40,9

See also

Updated on August 11, 2023

Was this article helpful?