ComponentOne True DBGrid Pro 8
Tutorial 7 - Displaying Translated Data with the Built-in Combo

In this tutorial, you will learn how to use the ValueItems collection to display translated text and enable the grid's built-in drop-down combo for editing—all without writing a single line of code.

  1. Start with the project created in Tutorial 6.

  2. Right-click TDBGrid1 to display its context menu.

  3. Choose Properties to display the Property Pages dialog. Select the Values property page by clicking the Values tab. This property page is used to specify the ValueItems collection associated with a column.

  4. Drop down the Column combo box and select Column1 (CustType).

  5. Check the Translate box to instruct the grid to translate the data in Column1 before displaying it. Note that the grid at the bottom of the property page now displays two columns labeled Value and DisplayValue.

  6. Drop down the Presentation combo box and select 2 - Combo Box. This instructs the grid to display a combo box in Column1 when requested.

  7. Now enter the Value - DisplayValue pairs in the grid as follows:

    Example Title
    Copy Code
    Value   Display Value
    
    1       Prospective
    
    2       Normal
    
    3       Buyer
    
    4       Distributor
    
    5       Other
    

    Entries in the Value column are data values from the CustType field in the database table. The grid treats the Value property as a string. Entries in the DisplayValue column are translated values to be displayed in the CustType column of the grid. For example, a CustType of 1 will be displayed as Prospective, 2 will be displayed as Normal, and so forth.

    Note: Some databases store numbers with a leading space character to hold the place of a minus sign, so it may be necessary to prefix Value column entries with a space.

    When you are finished entering data, the Values property page should look like this.

  8. Click the OK button at the bottom of the Property Pages dialog to accept the changes.

Run the program and observe the following:

This concludes Tutorial 7.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback