A closer look at the expressions entered in the controls reveals:
- The expressions will be longer and longer, the deeper the object structure is nested.
- The expressions have specializations, so-called typecasts, make it difficult to formulate the expressions in a uniform way.
- All controls to describe a product on a single form would be very confusing
Therefore, TCE supports the concept of embedded forms, also called subforms.
The main mask will be divided into several areas:
- Cross-product area (for items outside of product)
- Product area (for elements of the object product)
- Product Component Area (for Child Objects of the Object Product)
Therefore, a user interface forms must be defined in each object.
We define two forms (Product Settings and Product Form) in the Products class, and a form named Product Form in the Components class.
Among the type libraries of the knowledge base, we switch on the type libraries TCE Panel Controls and TCE Register Controls.
Then we divide the main mask. We remove items that are no longer needed.
In addition to the Combobox Product (which now has a Caption and CaptionWidth of 1500 twips), there is now a [Product settings] subform and a [Product form] subform.
Subforms have two control properties, the object (value) and the name of the form (form). If you like to address a form of a class directly, there is a possibility to enter the path to the form of a class into the value property.
The subform thus displays the product settings form of the selected product object.
Similarly, the product data subform is set.
So, what do the product settings and product data forms in the classes look like?
The feature [Country version] is still valid for all products. You define the control [Country version] for the variable [Country version] in the form Product Settings of the class Products (you can see, the definition class of the feature and of the control is the same!). The control is derived into all classes that are below the Products class.
This changes the expression for the value property of the control. Since the feature is also defined in the class Products, it is possible to refer directly to it.
In this realization of the tutorial we have decided on a register to display the many possible objects of the products scalable on a form. A complete implementation of a register consists of a register control and one or many tab controls, defined as child controls of the register control.
Therefore, in the form [Product Form] of the class Products there is the definition of the register.
In the Sigma class, where the objects were defined for the Sigma product, the register pages (tabs) in the register for these objects are now added.
Each tab which is defined here uses the form [Product Form] of the definition class (TCE class) of the object definitions.
Again, the variable controlling the form control (here the feature Color for the Combobox Color) can be taken directly from the class in which the element of the mask is defined.
The result of this modification is the synchronization of the object structure and the mask structure!
The launched application would look something like this:
(knowledge base Tutorial Stage 4)