Assigning GUI context classes
In order to implement specific behavior for a GUI resource (application rules), a context class has to be assigned to the resource. Typically, context classes are defined as control context classes, which apply on controls ( ADK_FieldControl ) or fields ( ADK_Field ). To application and project resources, application or project context classes might be assigned.
In order to react on GUI framework events, event handlers as being defined in the odabagui::GUIBaseContext class might be overloaded in derived application-defined context classes. Application-defined context classes have to be assigned to GI resources. Each application-defined context class may be associated with any number of GUI resources, i.e. a project context class might be associated with any number of project resources and control context classes might be associated with any number of field or field control resources.
Resources supporting context classes provide a context association feature:
When entering the class name in the context class field, a resource reference will be created automatically, when not yet existing. The number ( __AUTOIDENT ) of the resource reference assigned is displayed in the field right of the class name. In order to create a new context class, one may click the associate button left of the resource reference number. The class create pops up allowing defining class properties for initializing the class properly:
A default class name has bee created from the resource name prefixed by the option set in Options.Implementation.Naming.ControlContextClassPrefix . One may change the name or assign an existing context class from the drop list. The default base class is the system context class defined for the resource type (typically ControlContext ), but an alternative context class might be selected from the drop list.
As programming language, the project programming language will be proposed. In case of C++ or C## projects, one might change the programming language to OSI, when all functions in the class should be implemented as OSI functions.
When defining a new context class, clicking OK will create the new context class, initialize constructor, destructor and Create() function (C++, only). Finally, the context class is assigned to the resource reference.
Usually, control context classes are assigned to field controls. In this case, the context becomes active, wherever the field control is used. This allows defining controls, which might be used in different forms always showing the same behavior. Another way is, to assign a context to the field that references the control in a specific form. Since fields are not reusable, a control context assigned to a field becomes active only in the form, that contains the field. In case, that the field refers to a control context, but the referenced control, too, the control context assigned to the field is used.