The LISTBOX resource-definition statement creates a list box control, a rectangle containing a list of strings (such as filenames) from which the user can select one or more items.
LISTBOX id, x, y, width, height, flags
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 list box can be one or more of the following:
GW_OPT | Specifies that the list box is for an OPTION in the attached procedure. This is the default setting. |
GW_PARAM | Specifies that the list box is for a PARAMETER in the attached procedure. |
GW_AVAILABLE | Specifies the list box is an available data list box. This allows the data to be double clicked to move it into an edit control or droplist combo box. 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 within an edit control statement. |
LB_MULT | This specifies that the list box allows selection of one or more items; by default a list box is single selection. If the GW_AVAILABLE flag is set then a button is automatically appended below the list box to allow multiple selections to be copied to other controls. For a list box that does not have the GW_AVAILABLE flag set, the data are placed in a structure of an associated type by setting one of the following data type flags. 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). If no data type is specified the items will be displayed in a list, e.g. 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.
text
Text for a list box is supplied using the SLIST/RLIST statements and is automatically entered into the list box when the dialog is opened.
SLIST id,text,text,…
The id for SLIST must be the same as the id specified for the list box. The id is followed by a comma separated list of strings, for example, “apple”,”banana”,”carrot”,etc… If this is not set, the values displayed are those given in the RLIST statement.
Text for the responses that are to be used when the attached procedure is activated are supplied using the RLIST statement. If the RLIST statement is not set, then the values default to those set by SLIST. At least one of RLIST or SLIST must be set. The RLIST statement must be set if items in the SLIST contain any spaces. The number of items in SLIST and RLIST must be the same.
RLIST id,text,text,…
The id for RLIST must be the same as the id specified for the list box. The id is followed by a comma separated list of strings, for example, “a”,”b”,”c”,etc…
Examples
The following example demonstrates how to create an available data list:
LTEXT “&Available data:”,ITEXT,2,2,52,9
LISTBOX IDLIST,2,12,90,120,GW_AVAILABLE
This example shows how to create a list box containing three items along with the strings that will be used in the attached procedure.
LISTBOX IDLIST, 10, 10, 120, 90, GW_PARAM
SLIST IDLIST,”Mean”,”Variance”,”Standard error”
RLIST IDLIST,”mean”,”var”,”se”
See also
- Genstat resource language.
- Data type flags for available data lists.
- Example 1 – Summary Statistics.
- Example 2 – Transformations (using a user procedure).