Combo Box
Un combo box es similar a una lista desplegable, excepto que acepta texto introducido desde el teclado y tiene opciones adicionales.
Fundamentalmente, debe considerar un combo box como un área editable que utiliza su objeto, array o una lista de selección como el conjunto de valores por defecto.
Gestión de combo boxes
Utilice el evento On Data Change
para gestionar las entradas en el área editable, como lo haría con cualquier objeto del formulario de entrada.
Un combo box se inicializa exactamente igual que una lista desplegable: utilizando un objeto, un array o una lista de selección.
Utilizar un objeto
Esta funcionalidad sólo está disponible en los proyectos 4D.
Un objeto encapsulando una colección puede utilizarse como fuente de datos de un combo box. El objeto debe contener las siguientes propiedades:
Propiedad | Tipo | Descripción |
---|---|---|
values | Collection | Obligatorio - Colección de valores escalares. Todos los valores deben ser del mismo tipo. Tipos soportados: |
currentValue | igual que Collection | Texto introducido por el usuario |
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.
Utilizar un array
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.
Utilizar una lista de selección
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. Esto facilita la gestión de los campos/variables listados.
Si utiliza una lista jerárquica, sólo se muestra el primer nivel y se puede seleccionar.
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.
Opciones
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.
- Exclusión (lista de valores excluidos): permite establecer una lista cuyos valores no pueden introducirse en el combo box. Si se introduce un valor excluido, no se acepta y se muestra un mensaje de error.
La asociación de una lista de valores obligatorios no está disponible para los combo box. In an interface, if an object must propose a finite list of required values, then you must use a drop-down list object.
Propiedades soportadas
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