|
|
|
|
|
- Overview
- Initializing and populating a Combo Box control
- Initializing an element
- Initializing input in an editable Combo Box control
- Populating a Combo Box control
- Selecting an element in a Combo Box control
- Selecting an element in a Combo Box control
- Selecting the last element of a Combo Box control
- Retrieving the element selected in the Combo Box control
- Retrieving the index of the selected element
- Getting the value of the selected element
- Finding an element in a Combo Box control with a table
- Properties specific to Combo Box controls
Manipulating Combo Box controls programmatically
WINDEV, WINDEV Mobile and WEBDEV allow you to programmatically manipulate Combo Box controls. To do so, use the variable of the Combo Box control in the code. This variable is of type numeric. The variable of the Combo Box control: - corresponds to the name of the Combo Box control.
- is initialized with the index of the element selected in the control.
To handle an element of the Combo Box control, use the following notation: <Combo Box control>[<Element index>] Initializing and populating a Combo Box control Initializing an element To initialize an element in a standard or editable Combo Box control, use ListAdd. To modify an element in a standard or editable Combo Box control, use a direct assignment: <Combo Box control>[index] = <Value> Populating a Combo Box control To initialize a Combo Box control, simply use an iteration loop to initialize all the elements in the control.
Index is int FOR Index = <Start position> TO <End position> ListAdd(<Combo Box control>, <Value>) END Example:
i is int
FOR i = 1 TO 52
ListAdd(COMBO_COMBO, NAME[i])
END
Selecting an element in a Combo Box control Selecting an element in a Combo Box control To select the element at row <Index>, use: - direct assignment:
<Combo Box control> = Index - the ListSelectPlus function:
ListSelectPlus(<Combo Box control>, <Index>)
Remark: If the Combo Box control is initialized with gStoredValue, the value of gStoredValue must be used to select an element. For example, if the Combo Box control is initialized with the code:
ListAdd(COMBO_Person, "My text" + gStoredValue("StoredValue"))
the following code will be used to select an element: COMBO_Person = StoredValue
Selecting the last element of a Combo Box control To set the position on the last element of the Combo Box control, use: - the Count property:
<Combo Box control> = <Combo Box control>.Count - ListSelectPlus associated with the Count property:
ListSelectPlus(<Combo Box control>, <Combo Box control>.Count) - the ListCount function:
<Combo Box control> = ListCount(<Combo Box control>)
Retrieving the element selected in the Combo Box control Retrieving the index of the selected element To retrieve the index of the selected element, use one of the following syntaxes: - the element directly:
Index = <Combo Box control>
- the ListSelect function:
Index = ListSelect(<Combo Box control>)
Getting the value of the selected element To retrieve the value of selected element, use one of the following syntaxes: - Syntax 1: Non-editable Combo Box control
index is int = <Combo Box control> <Variable> = <Combo Box control>[Index] - Syntax 2: Non-editable Combo Box control
<Variable> = <Combo Box control>[<Combo Box control>] - Syntax 3: Editable or non-editable Combo Box controls: DisplayedValue property
Server code only
<Variable> = <Combo Box control>.DisplayedValue  Specific syntax: Editable Combo Box control:
<Variable> = <Combo Box control>
Finding an element in a Combo Box control with a table Properties specific to Combo Box controls The following properties are used to manage Combo Box controls: | | All types of Combo Box controls | HorizontalAlignment | Gets and sets the horizontal alignment of the elements in the Combo Box control. | Ellipsis | Gets and sets the ellipsis mode. | LineHeight | Gets and sets the height of the rows in a Combo Box control. | Memory | Indicates if the specified Combo Box control is populated programmatically or is based on a data file. | Count | Gets the number of rows in a Combo Box control. | FillType | Indicates how a Combo Box control is populated (programmatically, from a data file or from a variable). | Empty | Indicates if a Combo Box control is empty. | Editable Combo Box control only | WithInput | Gets and sets the input mode of the Combo Box control (editable or not editable). | Cursor | Gets and sets the position of the mouse cursor in a control. | CursorEnd | Gets and sets the end position of a selection made with the cursor. | MemoryFormat | Gets and sets the format of the returned value. | DisplayMask | Gets and sets the display mask. | InputMask | Gets and sets the input mask. | Size | Gets and sets the maximum number of characters in the input field of the Combo Box control. | SelectedText | Gets and changes the text selected in the input field of the Combo Box control. | InputType | Gets and sets the type of data entered in the input field of the Combo Box control. | Non-editable Combo Box control only | SearchAAF | Allows you to: - determine if the search option is enabled on a non-editable Combo Box control,
- enable or disable the search option via the AAF in a non-editable Combo Box control.
| Combo Box populated programmatically only | InitialContent | Gets the initial content of a Combo Box control populated programmatically. | Sorted | Indicates if a Combo Box control populated programmatically is sorted, or sorts the control. | Combo Box control based on a data file only | BrowsedFile | Gets and sets the data file or query used to display the records in Combo Box controls. | AutoBrowse | Indicates if a Combo Box control is looped through automatically or programmatically. | DisplayedItem | Gets and sets the item displayed in a Combo Box control. | StoredItem | Gets and sets the stored item of a Combo Box control. | BrowsedItem | Gets and sets the item used to automatically loop through Combo Box controls. |
For a complete list of WLanguage properties that can be used with Combo Box controls, see Combo Box control properties.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|