Tech Tip: Associating Objects with a Combo Box
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: April 15, 2024
A feature of project mode is the ability to assign an object that has been formatted in a specific way as the expression of a combo box form object.
The formatting of the object requires two attributes.
The .values attribute which should contain a collection of values for the options of the object.
The .currentValue attribute, contains the current value of the combo box. While a combo box provides a list of suggestions, a custom value not suggested is also allowed to be entered like a variable form object. When a value is selected from the .values collection or entered manually this value will be stored in the .currentValue attribute.
Below is a simple example of an object:
var comboObj : Object comboObj:=New object() comboObj.values:=New collection("a"; "b"; "c") comboObj.currentValue:="" // The inital value will be an empty string |
The object can then be applied to the combo box form object:
A combo box can contain any value such as "Hello World" entered below, it will also make suggestions for values to enter:
Selecting or changing the value of the combo box will automatically update the .currentValue attribute with the value.
This feature can be used to build combo boxes on the fly easier with the various ways to build a collection. As mentioned, this feature is project mode only, applying it to a binary mode database will not function properly.