4D v16.3

Combo Boxes

Home

 
4D v16.3
Combo Boxes

Combo Boxes  


 

 

A combo box is similar to a drop-down list, except that it accepts text entered from the keyboard and has two specific options. You initialize a combo box in exactly the same way as a drop-down list (see Pop-up Menus/Drop-down Lists).

If the user enters text into the combo box, it fills the 0th element of the array. In other respects, you treat a combo box as an enterable area that uses its array or a choice list as the set of default values.

Use the On Data Change event to manage entries into the enterable area, as you would for any enterable area object. For more information, refer to the description of the Form event command in the 4D Language Reference manual.

Combo box type objects accept two options concerning choice lists associated with them: Automatic insertion and Excluded List (list of excluded values).

The Automatic insertion option is found in the "Data Source" theme of the Property List for Combo box type objects:

Note: This option is also available for list box columns since its cells are displayed as combo boxes when a column is associated with a choice list.

When this option is checked, if a user enters a value that is not found in the choice list associated with the object, this value is automatically added to the list stored in memory. You can associate choice lists using the OBJECT SET LIST BY NAME or OBJECT SET LIST BY REFERENCE commands.

For example, given a choice list containing "France, Germany, Italy" that is associated with the "Countries" combo box: if the Automatic insertion option is checked and a user enters "Spain", then the value "Spain" is automatically added to the list in memory:

Naturally, the value entered must not belong to the list of excluded values associated with the object, if one has been set (see the following paragraph).

Note: If the list was created from a list defined in Design mode, the original list is not modified.

If the Automatic insertion option is not checked, the value entered is stored in the object but not in the list in memory.

The Excluded List option is provided in the "Range of Values" theme for combo box type objects; it allows you to associate a list of excluded values to these objects. When a user enters a value that belongs to this list, its entry is rejected automatically (see Excluded lists).

Note: 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 Pop-up menu type object.

 
PROPERTIES 

Product: 4D
Theme: Working with active objects

 
HISTORY 

 
ARTICLE USAGE

4D Design Reference ( 4D v16)
4D Design Reference ( 4D v16.1)
4D Design Reference ( 4D v16.3)