Smart Classes and Smart Triggers - How Smart Are They?
This section explores the intelligence exhibited by smart classes and smart triggers. How well these work and to what extent these don't are highlighted briefly .
How Smart Classes Exhibit Intelligence
The following lists how smart classes are smart enough to recognize the appropriateness of the objects to which they are applied:
- An object's smart classes pertain to only those classes that make sense for the object. In other words, a block smart class doesn't appear in the list of smart classes for a trigger object. The same holds true when a smart class is dragged from the Object Library and dropped in the Object Navigator.
- When a smart class is chosen for an object, the object under consideration will inherit the properties from the smart class object. The name of the target object remains the same. Selecting an object in the Object Navigator or Layout Editor and clicking the right mouse button displays a pop-up menu. In this menu, choosing the Smart Classes menu option lists a set of smart classes applicable to this object, if any. The developer can choose one among the list, and the smart class automatically gets applied to the object.
- Only those properties that make sense for the object are inherited.
- Individual smart-classed child objects cannot be deleted without deleting the parent.
- Only those smart classes corresponding to the given object type are displayed in the Smart Classes list when applying a smart class to an existing object. For example, when applying a smart class for a block object, a Property Class Smart Class is not shown in the list even though applying a Property Class to a block makes sense. This is an appreciable amount of smartness.
- Nested inheritance is supported. For example, if a block is based on a block smart class that is based on a property class, the properties in the property class are inherited by the original block. This is true when you apply the smart class to the original block by choosing from the smart class list or by dragging and dropping a smart class from the object library.
How Smart Classes Lack Intelligence
The following list details how smart classes are not smart enough when applied to objects and how they exhibit improper behavior:
- Smart class triggers enable the inheritance of their trigger text by a trigger that doesn't make sense for the corresponding object or that isn't compatible with the smart class trigger. Consider a POST-QUERY trigger that exists as a smart class in an Object Library. Choosing it from the list of Smart Classes for an item that already has a WHEN-NEW-ITEM-INSTANCE trigger defined (by right-clicking on the WHEN-NEW-ITEM-INSTANCE trigger) simply replaces its trigger text with the trigger text of the POST-QUERY trigger. Thus, it has not recognized that a POST-QUERY trigger doesn't make sense at the item level, and it has failed to understand that WHEN-NEW-ITEM-INSTANCE and POST-QUERY are two incompatible triggers.
- Smart classes do not support true multiple inheritance; that is, a given smart class cannot be based on two other independent smart classes. Even nested inheritance is not supported.
How Smart Triggers Exhibit Intelligence
When choosing the trigger list of an object, Forms 5.0 is intelligent enough to provide smart triggers applicable to that object and at levels higher than the default level. Even the standard drag and drop is intelligent enough to recognize the appropriateness of a given trigger. The same holds true when a smart class trigger is dragged from the Object Library and dropped in the Object Navigator.
How Smart Triggers Lack Intelligence
By default, Forms doesn't include WHEN-LIST-ACTIVATED triggers in the list of smart triggers for a T-LIST item. This is intelligent for a pop-list and combo-box but not for a T-LIST. Although WHEN-LIST-ACTIVATED appears when the Others option is chosen from the smart triggers list, the point here is that it is a special trigger only meant for a T-LIST, and Forms should be smart enough to list this trigger under the predefined smart triggers list. Smart triggers aren't necessarily the most commonly used triggers.
A second point illustrating how smart triggers lack intelligence is that there are no smart triggers for a sound item.