skip to main content
OpenEdge Development: ADM and SmartObjects
SmartObjects : SmartDataFields
 
SmartDataFields
A SmartDataField is an ADM field‑class SmartObject that displays a single data field. It is intended for inclusion only in a SmartDataViewer. You typically use a SmartDataField to provide a specially formatted display of the data in a selected field in the SmartDataViewer. To do this, you replace the field on the SmartDataViewer with your SmartDataField. For example, you might develop a SmartDataField that appears as a calendar and use it in a SmartDataViewer to display a date field.
Note: The field to be replaced with a SmartDataField must be a RowObject field chosen from a SmartDataObject.
Because there is no standard representation for a SmartDataField, it does not have a wizard and opens initially as a frame. You, as the application developer, determine how to represent your SmartDataField; for example, as a pick list or an ActiveX Control. You can create any user interface as long as it does the following:
*Retrieves the containing SmartDataViewer’s DataValue property value for the associated field and assigns it to the SmartDataField’s visualization of the field.
*Accepts a modified value from the visualization and assigns it to the DataValue property for the associated field.
For information about creating a SmartDataField and adding it to a SmartDataViewer, see the “SmartDataField usage notes” section.
Note that you might want to add any special SmartDataFields you create to the AppBuilder palette so you can easily reuse them in your applications. The ADM already includes one special SmartDataField: a SmartSelect. This SmartDataField, which is available from the menu that appears when you right‑click on the SmartDataField icon, performs a field lookup. See the “SmartSelects” section.
Table 2–8 lists the SmartDataField files.
 
Table 2–8: SmartDataField files 
File type
Filename / SmartLinks
Template file
src/adm2/template/field.w
Primary include file
src/adm2/field.i
ADM/Progress Advisor‑supported SmartLinks
– (None)
Instance properties dialog box
Implementation dependent
SmartDataField instance properties
Figure 2–6 shows an example of an instance properties dialog box for a SmartDataField.
Figure 2–6: SmartDataField instance properties dialog box
Recall there is not a standard instance properties dialog box for a SmartDataField; therefore, the appearance of the instance properties dialog box for a SmartDataField—and the properties available from it—are implementation-dependent.
SmartDataField usage notes
This section discusses special programming considerations for using SmartDataFields.
Creating SmartDataFields
Because SmartDataFields do not have a wizard, you must create them yourself. Here are the general steps for creating a SmartDataField, which you perform in the AppBuilder:
1. Define the visualization of the SmartDataField; for example, by dropping an ActiveX Control onto it.
2. Write code to set the DataModified property; for example, when the field’s value is changed in an AfterUpdate ActiveX event trigger.
3. Implement the setDataValue and getDataValue functions (the template includes stubs for these functions):
*The setDataValue function, which is run from displayFields in the SmartDataViewer, sets the value of the field’s visualization by passing in the SmartDataObject field value to be assigned to the visualization.
*The getDataValue function returns the current value of the field’s visualization to the caller (typically collectChanges in the SmartDataViewer).
*To signal the Table-IO source that the user modified data, create a VALUE-CHANGED trigger for the SmartDataField that contains the following single line:
 
{set DataModified yes}
4. Implement the disableField and enableField procedures to enable and disable the visualization (the template includes stubs for these procedures). There also are DisplayField and EnableField properties:
*The displayField property specifies whether the data value for the field is assigned to the SmartDataField automatically.
*The enableField property specifies whether the SmartDataField is updateable.
By default, these properties are set based on the corresponding properties for the original SmartDataObject field, but they can be set in the instance properties dialog box.
5. Modify the use list for the SmartDataField icon in the smart.cst file to include your special SmartDataField. This enables you to reuse your SmartObject by selecting it from the AppBuilder palette.
For instructions on using the AppBuilder, see OpenEdge® Development: AppBuilder.
Adding SmartDataFields to SmartDataViewers
You add SmartDataFields to a SmartDataViewer after you pick all of the fields that will appear in the viewer (using the wizard). To add a SmartDataField, select it from the AppBuilder palette and drop it onto the SmartDataObject field it is to replace. As when you add SmartObjects to other SmartContainers, the AppBuilder then generates an adm-create-objects procedure to start the SmartDataField, including a FieldName property whose value is the name of the original SmartDataObject field.