Tutorial 7: Displaying Translated Data with the Built-In Combo
In This Topic
In this tutorial, you will learn how to use the ValueItems object to display translated text and enable the grid's built-in drop-down combo for editing—all without writing a single line of code.
Complete the following steps:
- Start with the project created in Tutorial 6: Defining Unbound Columns in a Bound Grid.
- Make sure the C1TrueDBGrid has focus, then click the ellipsis button next to the Columns property in the Properties window. This brings up the C1TrueDBGrid Designer.
- Select the CustType column member. Then in the left pane, click the expand icon next to the Valueitems property. This will display all of the members of the Valueitems object.
- Click on the ellipsis button next to the Values property in the C1TrueDBGrid Designer. This brings up the ValueitemCollection Editor.
- In the left pane create five new ValueItem objects by clicking on the Add button five times. Notice that a ValueItem has two properties: DisplayValue and Value.
- Enter the following DisplayValue/Value pairs into the right pane, then close the ValueItemCollection Editor:
DisplayValue |
Value |
Value |
0 |
Prospective |
1 |
Normal |
2 |
Buyer |
3 |
Distributor |
4 |
Other |
5 |
- Under the Valueitems object in the C1DataColumn Editor, set the Presentation property to ComboBox, and the Translate property to True.
- Click the OK button at the bottom of the Property Pages dialog box to accept the changes.
Run the program and observe the following:
- C1TrueDBGrid1 displays data from the joined tables as in Tutorial 6: Defining Unbound Columns in a Bound Grid.
- The CustType column now displays the translated text instead of numeric values.
- Click a cell in the CustType column to make it the current cell. Notice that a drop-down button appears at the right edge of the cell.
- Click the drop-down button or press ALT+DOWN ARROW to display the built-in combo box containing translated values, as shown in the following figure. Change the data in the current cell by selecting the desired item from the combo box.
This concludes this tutorial; you've successfully completed displaying translated data with the built-in combo.