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

Edit controls (Genstat Resource Language)

The EDITTEXT resource-definition can be used to create an edit control, a rectangular control window typically used to permit the user to enter and edit text by typing on the keyboard. The edit control allows a single line of input.

EDITTEXT [text,] id, x, y, width, height, flags

text
The text to be displayed in the edit control. The text should be supplied within double-quotes, for example, “my text”. This is optional and if no text is to be displayed then this can be ignored (see example below).

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

flags
The flags for the edit control can be one or more of the following:

GW_OPT Specifies that the edit control is for an OPTION in the attached procedure.
GW_PARAM Specifies that the edit control is for a PARAMETER in the attached procedure.
GW_AVAILABLE If an available data list box is on the dialog this allows the data to be double clicked to move it into the edit control. You can restrict the data displayed in the available data to a subset of data types by setting one or more of the data type flags.
EC_SET Checks that text has been entered into the edit control when the attached procedure is run. If no text has been entered an error prompt appears.
EC_MULT This specifies that the edit control can contain one or more strings separated by commas or spaces. When the results are passed to the associated procedure, the spaces are replaced by commas and the data are placed in a structure of an associated type. If the flag DT_TYPTEX is used the items will be quoted and placed in an unnamed text, e.g. !t(‘a’,’b’,’c’). If the flag DT_TYPVAR is used the items will be placed in an unnamed variate, e.g. !(1,2,4). Similarly, if DT_TYPPOI is used the items will be placed in an unnamed pointer, e.g. !p(a,b,c).

Note: only one of the flags GW_OPT or GW_PARAM can be set. To specify more than one flag use the ‘|’ character. For example, GW_MULT | GW_PARAM | DT_TYPPOI or GW_MULT | GW_OPT | DT_TYPVAR.

Associating a browse button
If the PUSHBUTTON flag BS_BROWSE is specified and contains the same id as the edit control, then any file name selected using the browse for file dialog will be entered into the edit field.

Examples
The following example demonstrates how an edit control can accept data from an available data list and restrict the list to display only variates:

EDITTEXT IDDATA, 10, 10, 90, 14, GW_PARAM | GW_AVAILABLE | DT_TYPVAR | EC_SET

This example shows how you can include default text to appear in the edit control when the dialog is opened.

EDITTEXT “0.95”,IDCONFLIMIT, 10, 10, 90, 14, GW_OPT

The next example demonstrates how to create a browse button to select a file and enter its name into an associated edit field:

LTEXT “&Output file:”,ISTATIC,2,80,40,9
EDITTEXT OUTFILE,45,80,140,14, GW_PARAM
PUSHBUTTON “…”, OUTFILE, 190, 80, 30, 14, BS_BROWSE | GW_SAVE

See also

Updated on May 8, 2019

Was this article helpful?