Was this helpful?
How You Can Load the Listview Field with Data
A listview field is a choice field, and like other choice fields has a ValueList attribute. The ValueList attribute is a ChoiceList. Unlike the other choice fields, the ChoiceItems attribute of the ValueList of a listview field is an array of ChoiceDetail objects. Each ChoiceDetail object contains information about a row in the listview field.
The ChoiceDetail class has the following attributes:
EnumDisplay
Contains the text, which is displayed in the first column of the listview
EnumText
Contains a text string
EnumValue
Contains an integer value that you may use to identify an item in the list
IsSelected
Indicates at runtime whether the item is currently selected
EnumBitmap
Is not used by listview fields
EnumSubText
Specifies an array of StringObjects. The nth item in the array contains the text that is displayed in column n + 1 of the listview.
ImageIndex
Specifies an index into the arrays SmallImageList and LargeImageList that are associated with the listview field. These arrays are arrays of BitmapObjects. The ImageIndex attribute let you specify a bitmap to be displayed with a listview item.
When you examine the load_listview procedure, you can see how data is loaded into the listview field. The first step clears the ChoiceItems array. The procedure uses the AddItem method of the ChoiceList to add each new ChoiceDetail object to the ChoiceList. The AddItem method adds a ChoiceDetail object to the array and returns the position of the new item in the array. After using AddItem to create a ChoiceDetail object and add it to the ChoiceList, it sets the first name and extension in the EnumSubText array and sets the ImageIndex attribute using the previously calculated value.
Finally, after adding the items to the ChoiceList, it invokes the UpdChoiceList method of the listview field and causes the new data to be displayed.
Last modified date: 12/20/2023