vcl-171179-expressquantumgrid-tutorials-master-detail-tutorial-step-5-specifying-editors-for-items.md
Assigning editors to items allows the end-user to edit dataset fields in a more convenient way. In this section, editors are assigned to three items:
a radio group (TcxRadioGroup) is assigned to the GENDER column in the tvPersons View
a lookup editor (TcxLookupComboBox) is assigned to the PERSONID column in the tvStaff View
an image editor (TcxImage) is assigned to the SCREEN row in the cvFilmScreens View
To assign editors to items in this tutorial, use the Properties property.
Note
to specify the editor via code, you should use the PropertiesClass property as well.
Set the column’s Properties property to RadioGroup by selecting the corresponding value from the dropdown list:
Now expand the Properties property and click the ellipsis button in the Items value box. This opens a standard collection editor where we can now add items:
Add two items by clicking the button twice. Items will be used to represent the male or female sex of a person. Set the Caption property of the first item to Male and the Value property to True.
For the second item, set the Caption property to Female and the Value property to False.
The following image shows a cell from the GENDER column with a radio group specified as an editor:
Display the properties of the tvStaffPERSONID column of the tvStaff View in the Object Inspector as shown above. Set its Properties property to LookupComboBox. Then set the attributes of the Properties object as follows:
This sets the source of records displayed in the dropdown and in the edit box of the lookup combo box.
The ListFieldNames property identifies fields displayed in the dropdown of the lookup editor.
The KeyFieldNames property specifies the field(s) used to identify records from ListSource. The values of this field must match the values of the current column (tvStaffPERSONID).
This sets the width of the dropdown window.
The ListFieldIndex addresses the column in the dropdown to display in the edit box. The value of the property defines a zero-based index of a field within the ListFieldNames list. ListFieldIndex is set to 1 and so addresses the SECONDNAME field.
The following image shows a lookup editor assigned to the tvStaffPERSONID column:
Graphics provided by the dataset field are interpreted as JPEG images.
This stretches the image to accommodate the size of cells.