Skip to content
Carlo Barazzetta edited this page May 26, 2020 · 7 revisions

The Exposer component

TInstantExposer is a dataset component that maps objects to the user interface of your application. Attributes defined in the business model are accessed through properties. Properties that are published can be accessed by data-aware controls via this component. In addition, the content of container attributes can be accessed too. The exposer component maps the published properties of objects to fields in a dataset. The objects being exposed are represented as rows in the dataset.

To expose an object, it must be assigned to the Subject property of a TInstantExposer. To expose multiple objects contained within another object, assign the main object to the Subject property and enter contentmode by changing the Mode property from amObject to amContent. If the exposed class has no default container, specify the desired container in the property ContainerName. Specify the class of the exposed, contained object(s) in the property ObjectClassName.

By default, an exposer will make all simple properties of each exposed object as well as any related object available through fields in the dataset. Every field will have a FieldName matching the property it represents. For related objects, the fieldname will be the complete path to the property using regular dot notation. The property FieldOptions and the event OnIncludeField allow you to limit or extend the number fields to include.

Container attributes of exposed objects are automatically recognized by the exposer and are represented as nested datasets within the exposer.

Exposers can be linked together in master/detail relationships. To link one exposer to another, assign the master exposer to the DataSet property of a TDataSource and assign the TDataSource to the MasterSource property of the detail exposer.

The Subject of the detail exposer will be set to the current object of the master exposer and updated whenever this changes. If you want the detail exposer to expose an object that is related to the current object of the master exposer instead, simply specify the desired property path in MasterProperty.

TInstantExposer is not limited to exposing TInstantObject descendants. Any object with published propertied can be exposed. The content of standard VCL containers like TList, TObjectList and TCollection can be exposed in content mode.

Clone this wiki locally