Release 10.1A: OpenEdge Development:
ADM and SmartObjects

> ## 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.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095