The COMBOBOX resource-definition statement creates a combination box control (a combo box), consisting of either a static text box or an edit box combined with a list box. The list box portion can be displayed by clicking on the button to the right of the static text or edit box. If the combo box contains a static text box, then the selection (if any) from the list box portion of the combo box will always be displayed in the text box. If it uses an edit box, the user can type the selection directly in the edit box.
COMBOBOX 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 combo box is for an OPTION in the attached procedure. This is the default setting. |
GW_PARAM | Specifies that the combo box is for a PARAMETER in the attached procedure. |
CB_DROPDOWN | Creates a combo box with an edit box. |
CB_DROPLIST | Creates a combo box with an static text box (this is the default). |
Note: only one of the flags GW_OPT or GW_PARAM can be set and only one of CB_DROPDOWN and CB_DROPLIST. To specify more than one flag use the ‘|’ character. For example, GW_DROPDOWN | GW_PARAM.
text
Text for a combo box is supplied using the SLIST/RLIST statements and are automatically entered into the combo box when the dialog is opened.
SLIST id,text,text,…
The id for SLIST must be the same as the id specified for the combo 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.
When the CB_DROPLIST flag is set, the text for the responses passed to the attached procedure is supplied using the RLIST statement. RLIST must be set if the entries in SLIST contain spaces.
RLIST id,text,text,…
The id for RLIST must be the same as the id specified for the combo box. The id is followed by a comma separated list of strings, for example, “a”,”b”,”c”,etc… 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. If both RLIST and SLIST are set, the number of entries in them must be the same.
Example
The following example demonstrates how to create a droplist combo box (CB_DROPLIST flag). Note that the height of the control specifies the height of the list box part of the combo box:
COMBOBOX IDLIST, 10, 10, 120, 90, GW_PARAM | CB_DROPLIST
SLIST IDLIST,”Mean”,”Variance”,”Standard error”
RLIST IDLIST,”mean”,”var”,”se”
This example shows how to create an edit combo box (CB_DROPDOWN flag):
COMBOBOX IDLIST, 10, 10, 120, 90, GW_PARAM | CB_DROPDOWN
SLIST IDLIST,”Mean”,”Variance”,”Standard error”
RLIST IDLIST,”mean”,”var”,”se”