OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Mixing TView or a TView-derived object with an interface object class gives you the ability to display data from a document and makes that ability integral with handling the flow of data to and from the document object.
To mix a view class with an interface object class is a fairly straightforward task, but one that must be undertaken with care.
To derive your new class, define the class based on your base view class (TView or a TView-derived class) and the selected interface object. The new constructor should call the constructors for both base classes and initialize any data that needs to be set up. At a bare minimum, the new class must define any functions that are declared pure virtual in the base classes. It should also define functions for whatever specialized screen activities it needs to perform and define event-handling functions to communicate with both the interface element and the document object.
The advantage of this approach is that the resulting view is highly integrated. Event handling is performed in a central location, reducing the need for event handling at the application level. Control of the interface elements does not go through a pointer but is also integrated into the new view class.
The disadvantage of this approach is that you lose the flexibility you have with a pointer. You cannot quickly detach and attach new interface objects because the interface object is an organic part of the whole view object. You also cannot exchange different types of objects by using a base pointer to a different interface object classes. Your new view class is locked into a single type of interface element.