PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • 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 the management of Combo Box controls
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
WINDEV, WINDEV Mobile and WEBDEV allow you to programmatically handle 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:
<Champ Combo>[<Indice de l'élément>]
Remark: There are multiple WLanguage functions specific to Combo Box controls. For more details, see: List Box and Combo Box management functions and functions specific to Combo Box controls.
Initializing and populating a Combo Box control

Initializing an element

To initialize an element in a standard or editable Combo Box control, use <List Box>.Add.
To modify an element in a standard or editable Combo Box control, use a direct assignment:
<Champ Combo>[Indice] = <Valeur>
Android In Android, negative or null values cannot be assigned to a Combo Box control. If the Combo Box control is not empty, an element has to be selected. An error will occur if a negative or null value is assigned to a Combo Box control.
WINDEVJava

Initializing input in an editable Combo Box control

To initialize input in an editable Combo Box, use:
  • direct assignment:
    <Champ Combo> = <Valeur>
  • the <List Box>.Add function.
    // Add elements to a Combo Box control
    COMBO_COMBO1.Add("MOORE")
    COMBO_COMBO1.Add(Cust_Name)

Populating a Combo Box control

To initialize a Combo Box control, simply use an iteration loop to initialize all the elements in the control.
Indice est un entier
POUR Indice = <Position Début> A <Position Fin>
<Champ Combo>.Ajoute(<Valeur>)
FIN
Example:
i is int
FOR i = 1 TO 52
COMBO_COMBO.Add(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:
    <Champ Combo> = Indice
  • the <List Box>.SelectPlus function:
    <Champ Combo>.SelectPlus(<Indice>)
WINDEVJava Remark: Only the second syntax can be used in an editable Combo Box control.
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_Personne, "Mon texte" + gStoredValue(ValeurMémorisée))
the following code will be used to select an element:
COMBO_Personne = ValeurMémorisée

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:
    <Champ Combo> = <Champ Combo>.Occurrence
  • <List Box>.SelectPlus associated with the Count property:
    <Champ Combo>.SelectPlus(<Champ Combo>.Occurrence)
  • the <List Box>.Count function:
    <Champ Combo> = <Champ Combo>.Occurrence()
WINDEVJava Remark: Only the last syntax can be used in an editable 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:
    Indice = <Champ Combo>

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
    indice est un entier = <Champ Combo>
    <Variable> = <Champ Combo>[indice]
  • Syntax 2: Non-editable Combo Box control
    <Variable> = <Champ Combo>[<Champ Combo>]
  • Syntax 3: control Combo Box with or without input: DisplayedValue property
    WEBDEV - Server code Server code only
    <Variable> = <Champ Combo>.ValeurAffichée
  • WINDEVJava Specific syntax: Editable Combo Box control:
    <Variable> = <Champ Combo>
Finding an element in a Combo Box control with a table
WINDEVJava To find an element in a Combo Box control with a table, use TableSearch.
Reminder: To perform a search in a "standard" Combo Box control, use <List Box>.Seek.
Properties specific to the management of Combo Box controls
The following properties are used to manage Combo Box controls:
All types of Combo Box controls
HorizontalAlignmentGets and sets the horizontal alignment of the elements in the Combo Box control.
EllipsisGets and sets the ellipsis mode.
LineHeightGets and sets the height of the rows in a Combo Box control.
MemoryIndicates if the specified Combo Box control is populated programmatically or is based on a data file.
CountGets the number of rows in a Combo Box control.
FillTypeIndicates how a Combo Box control is populated (programmatically, from a data file or from a variable).
EmptyIndicates if a Combo Box control is empty.
Editable Combo Box control only
WithInputGets and sets the input mode of the Combo Box control (editable or not editable).
CursorGets and sets the position of the mouse cursor in a control.
CursorEndGets and sets the end position of a selection made with the cursor.
MemoryFormatGets and sets the format of the returned value.
DisplayMaskGets and sets the display mask.
InputMaskGets and sets the input mask.
SizeGets and sets the maximum number of characters in the input field of the Combo Box control.
SelectedTextGets and changes the text selected in the input field of the Combo Box control.
InputTypeGets and sets the type of data entered in the input field of the Combo Box control.
Non-editable Combo Box control only
SearchAAFAllows 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
InitialContentGets the initial content of a Combo Box control populated programmatically.
SortedIndicates if a Combo Box control populated programmatically is sorted, or sorts the control.
Combo Box control based on a data file only
BrowsedFileGets and sets the data file or query used to display the records in Combo Box controls.
AutoBrowseIndicates if a Combo Box control is looped through automatically or programmatically.
DisplayedItemGets and sets the item displayed in a Combo Box control.
StoredItemGets and sets the stored item of a Combo Box control.
BrowsedItemGets and sets the item used to automatically loop through Combo Box controls.

For a complete list of WLanguage properties that can be used with a Combo Box control, see Properties associated with Combo Box controls.
Minimum version required
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment