Creating a List Item
To create a List item:
- In the Object Navigator, expand the desired block node.
- Click the Items node.
- Click Create in the toolbar.
A new item with a default name is inserted under the Items
node.
- Double-click the object icon next to the newly created item to display the
Property Palette.
- Under the General node, set the Item Type property
to List Item.
- Under the Physical node, set the Canvas property
to the name of the desired canvas.
Note: To display
an item at runtime, you must assign it to a canvas.
- Specify the display style for the List by setting the List Style property
(under the Functional node) to PopList, TList,
or Combo Box. PopList is the default.
- Double-click the Elements in List property (also under the Functional
node) to display the List Item Elements dialog, then enter the elements exactly
as you want them to appear in the List item at runtime.
Tip: To insert a new element in the List, press
[Down] or [Insert Element]. To remove an element from the List, press [Remove
Element].
Note: As an
alternative to defining List item values at design time, you can also add
List elements individually at runtime by using the ADD_LIST_ELEMENT Built-in
subprogram, or you can populate the List from a record group at runtime using
the POPULATE_LIST Built-in. If you populate the List from a record group,
be sure that the record group you are using to populate the List contains
the relevant values before you call POPULATE_LIST. If the record group is
a static record group, it will already contain the appropriate values. Otherwise,
you should populate the group at runtime using one of the record group subprograms.
- Associate a value with each element in the List by entering the desired
value in the List Item Value field, then click OK.
The List Item Value field displays the value associated with the element currently
highlighted in the List Elements column. The values you assign to each element
must be compatible with the datatype (CHAR, NUMBER, or DATE) of the List item.
Tip: To assign a Null value to an element, leave
the List Item Value field blank.
Note: The value
for an element cannot be longer than the number of characters specified by
the List item's Maximum Length property.
- You must specify how you want a List item to handle a fetched or assigned
value that is not one of the values associated with a specific element. To
do so, set the List item's Mapping of Other Values property, under the Functional
node:
- Leave the Mapping of Other Values property blank to indicate that other
values are not allowed for this item. Any queried record that contains
a value that does not match one of the values associated with an element
in the List is silently rejected. Any attempt to assign an other value
is disallowed.
- Enter a value that evaluates to one of the values associated with a
specific element, or to the name of one of the elements.
Note: The Mapping
of Other Values property applies only to List element values fetched from
the database or assigned programmatically at runtime. When end users select
an element, the value of the List item is always the value associated with
that element--never an Other Value.
Related topics
About List Items
About List Element Values
About List Item Initial Values
Specifying an Initial Value for a List Item
Manipulating List items at Runtime
POPULATE_LIST Built-in
About Record groups
POPULATE_GROUP Built-in