Language Reference Guide : 4. System Classes : ChoiceList Class
 
Share this page                  
ChoiceList Class
The ChoiceList class provides attributes and methods for the field types that display a fixed set of choices to the end user, including EnumField (RadioField, OptionField, and ListField), MenuList, and PaletteField. One ChoiceList attribute, ChoiceItems, contains the set of choice values. ChoiceItems is an array of ChoiceItem objects.
In most applications, you specify the choice values on the property sheet for the field or menu. However, you also can manipulate the choices from the 4GL code. For example, you can use a select loop to load the values into the ChoiceItems array dynamically from values in the database. For an example, see the discussion of dynamic programming in the Programming Guide.
If you update a choice list that is attached to a displayed field, use the UpdChoiceList method on the field to make the changes visible.
If two or more fields on a form have the same choices, those fields can share one choice list. To implement this behavior, define the choices for one field and then assign the reference to that field's choice list to the other fields.
For example, if fields fg_color and bg_color are both option fields that have the same set of choices, you can define the choices in the property sheet for the fg_color field only. Then, use the following statements in the frame's initialize section so that bg_color can share the same list:
field(bg_color).ValueList =
field(fg_color).ValueList;
field(bg_color).UpdChoiceList();
Inherits From
Object Class
Inherited By
None
Attributes
ChoiceItems
Methods
AddBitmapItem
AddItem
AddTextItem
BitmapByDisplay
BitmapByIndex
BitmapByText
BitmapByValue
DisplayByBitmap
DisplayByIndex
DisplayByText
DisplayByValue
IndexByBitmap
IndexByDisplay
IndexByText
IndexByValue
TextByBitmap
TextByDisplay
TextByIndex
TextByValue
ValueByBitmap
ValueByDisplay
ValueByIndex
ValueByText