Combo Box
Une combo box est semblable à une liste déroulante, hormis le fait que cet objet accepte la saisie de texte par l’utilisateur et qu'elle dispose d'options supplémentaires.
Fondamentalement, vous devez considérer l’objet combo box comme une zone saisissable qui utilise un tableau ou une liste de choix en tant que liste de valeurs par défaut.
Gestion des combo boxes
Utilisez l’événement formulaire On Data Change
pour gérer les valeurs saisies, comme pour toute zone de saisie.
You initialize a combo box in exactly the same way as a drop-down list: using an object, an array, or a choice list.
Utilisation d'un objet
Cette fonctionnalité n'est disponible que dans les projets 4D.
An object encapsulating a collection can be used as the data source of a combo box. Cet objet doit avoir les propriétés suivantes :
Propriété | Type | Description |
---|---|---|
values | Collection | Obligatoire - Collection de valeurs scalaires. All values must be of the same type. Supported types: |
currentValue | identique à Collection | Text entered by the user |
If the object contains other properties, they are ignored.
When the user enters text into the combo box, the currentValue
property of the object gets the entered text.
Utiliser un tableau
Please refer to Using an array in the drop-down list page for information about how to initialize the array.
When the user enters text into the combo box, the 0th element of the array gets the entered text.
Utiliser une énumération
If you want to use a combo box to manage the values of an input area (listed field or variable), 4D lets you reference the field or variable directly as the form object's data source. Cette possibilité facilite la gestion des champs/variables énuméré(e) s.
Si vous utilisez une énumération hiérarchique, seul le premier niveau sera affiché et sélectionnable.
To associate a combo box with a field or variable, you can just enter the name of the field or variable directly in the Variable or Expression of the form object in the Property List.
When the form is executed, 4D automatically manages the combo box during input or display: when a user chooses a value, it is saved in the field; this field value is shown in the combo box when the form is displayed:
Please refer to Using a choice in the drop-down list page for more information.
Options
Combo box type objects accept two specific options:
- Automatic insertion: enables automatically adding a value to the data source when a user enters a value that is not found in the list associated with the combo box.
- Exclusion (liste de valeurs exclues) : permet d'établir une liste dont les valeurs ne peuvent pas être saisies dans la combo box. Si une valeur exclue est saisie, elle n'est pas acceptée et un message d'erreur s'affiche.
Associating a list of required values is not available for combo boxes. In an interface, if an object must propose a finite list of required values, then you must use a drop-down list object.
Propriétés prises en charge
Alpha Format - Bold - Bottom - Choice List - Class - Date Format - Expression Type - Font - Font Color - Font Size - Height - Help Tip - Horizontal Sizing - Italic - Left - Object Name - Right - Time Format - Top - Type - Underline - Variable or Expression - Vertical Sizing - Visibility - Width