Combo boxes and list boxes enable end users to select a value from a list. List boxes display as much of the list as there is room in the box. If the list is larger than the box, WebFOCUS Maintain will display scroll bars to enable end users to view the other options. You can also enable list boxes so that the end user can select more than one option. Combo boxes are only one line long. To select an option, the end user must click the arrow at the right side of the box to see the list.
The contents of the list are determined dynamically at run time by one of the following:
Note: You must create a variable with the data type, Stack of.
Caution: Do not bind SelectedItem or SelectedItems to a data source stack that already contains data. This will replace the contents of the data source stack with the result of the selection.
Note: Since end users can select multiple values in a list box, you must bind the value to a stack.
To create an item in the List Source dialog box, do one of the following:
To edit an item in the List Source dialog box, do one of the following:
Tip: To define the list, you can drag text from any application (for example, Notepad) on top of a combo box, list box, or group of radio buttons.
If you want to set the value of a combo box or list box dynamically, issue the following command
COMPUTE Formname.ControlName.ListItems.FocIndex = n;
where:
Is the name of the form the check box is placed on.
Is the name of the combo box or list box.
Is the name of an internal data source stack that contains the values for the combo box or list box.
You can also reset the values of all controls in a form to their initial values using the Winform Reset command. For more information, see Manipulating Form Properties.
You can preselect items in a list box with the MultiSelection property turned on using the following syntax:
Winform Show_Inactive Formname;Formname.ListBoxName.SelectedItems(1) = "value1";Formname.ListBoxName.SelectedItems(2) = "value2"; . . . Formname.ListBoxName.SelectedItems(m) = "valuen";
where:
Is the name of the form the check box is placed on.
Is the name of the list box.
Is the name of an internal data source stack that can contain an array of multiple preselected items. Like all stacks, it is a 1-based, not 0-based, array.
The List Source dialog box is used to determine the contents of your list box, radio button, or combo box.
The List Source dialog box contains the following elements:
Select As entered here to manually enter list items.
Select From a variable to retrieve the list from a data source stack column, variable with data type Stack of, or ACCEPT list for a data source field. This enables you to determine at run time which items should appear in the list. When you select this option, you will see a list of available Maintain variables in your procedure and data source fields with ACCEPT lists.
Displays the prompt text for each item.
Displays the values assigned to the prompt text for each item.
Adds a selected item to the list of fields by opening the Enter a List Item dialog box.
Deletes a selected item from the list of items.
Moves a selected item up in the list of items.
Moves a selected item down in the list of items.
Opens the New Variable dialog box, where you can create a variable with the data type, Stack of.
Opens the Stack Editor, where you can create a stack.
Contains a list of the existing stacks and variables in your procedure. Either select a variable, or expand a data source stack and select a column.
Lists the data sources used in this procedure with fields that have an ACCEPT list. You will not see this option if you do not have any such fields.
You can use the Enter a List Item dialog box to manually enter list items and assign values to the items you enter.
This dialog box contains the following elements:
Contains the list item displayed to the end user.
Contains the value generated if the end user selects this item. Later, you can store this value in the data source.
Use the Binding the Selection Result dialog box to bind your selection results to a variable or data source stack column as text, or as a value.
Caution: Do not bind your selection results to a data source stack that already contains data. This will replace the contents of the data source stack with the selection result.
This dialog box contains the following elements:
Contains whatever you selected below.
Removes your current selection if you do not want to bind the selection result.
Opens the New Variable dialog box, where you can create a variable.
Opens the Stack Editor, where you can create a stack.
Contains a list of the existing stacks and variables in your procedure.
Either select a variable, or expand a data source stack and select a column.
Lists the fields from the data sources used in this procedure.
Select Text to save the text value you entered in the List Source dialog box.
Select Value to save the value you entered in the List Source dialog box.
When you select your combo box or list box, you will see a list of combo box or list box properties in the property sheet. Changing these properties will change what your edit box or multi-edit box looks like and what it does at run time.
Many of the styling properties can also be changed using a Cascading Style Sheet. For more information on Cascading Style Sheets, see Using Cascading Style Sheets.
Choose your combo box property or list box property based on the task you wish to perform:
If you want to change the contents of the combo box of list box, use the ListItems Property to open the List Source dialog box. For more information, see the List Source Dialog Box.
If you want to change the name of the combo box or list box that identifies it to the procedure, use the (Name) Property. For more information, see the (Name) Property.
If you want to assign the value selected by the end user to another variable, use the SelectedItem or SelectedItems Property to open the Binding the Selection Result dialog box. For more information, see Binding the Selection Result Dialog Box.
If you want to enable an end user to select more than one item in a list box, use the MultiSelection Property. This property does not apply to combo boxes. For more information, see the MultiSelection Property.
If you want to change the size or location of the combo box or list box, use the Bottom Property, Left Property, Right Property, Top Property, or use a style sheet. For more information, see the Bottom Property, Left Property, Right Property, and Top Property. You can also move or resize the combo box or list box directly in the form.
If you want to change the color of the combo box or list box, use the BackColor Property to determine the color of the box, the ForeColor Property to determine the color of the text in the box, or use a style sheet. For more information, see the BackColorOver Property and the ForeColor Property.
If you want to change the font in the combo box or list box, use a style sheet or use the Font Property. For more information, see the Font Property.
If you want to make the combo box or list box inactive or make it invisible, use the Enabled Property to determine whether the combo box or list box is active or not. If the combo box or list box is inactive, it will be dimmed out and nothing will happen when the end user clicks it. You can also use the Visible Property to determine whether the combo box or list box is visible to the end user or use a style sheet. For more information, see the Enabled Property and the Visible Property.
If you want to display a tooltip when the cursor is on the top of the combo box or list box, use the ToolTipText Property. For more information, see the ToolTipText Property.
If you want to assign a Help topic to the combo box or list box, use the Help Property. For more information, see Assigning Help to Your Forms and Controls.
If you want the end user to be able to tab to the combo box or list box, use the Tabstop Property. For more information, see the Tabstop Property.
If you want to move the combo box or list box to another layer, use the Layer Property. For more information, see Layering Controls.
If you want to control the display order of the combo box or list box when more than one control is overlaid, use the ZIndex Property. For more information, see the ZIndex Property.
WebFOCUS |