OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Doc/View Event Handling in the Application Object

The application object generally handles only a few events, indicating when a document or a view has been created or destroyed.

The dnCreate event is posted whenever a view or document is created. The dnClose event is posted whenever a view or document is closed.

To set up response table entries for these events, add the EV_OWLDOCUMENT and EV_OWLVIEW macros to your response table as follows:

  • Use the EV_OWLDOCUMENT macro to check for
    • The dnCreate event when a new document object is created. The standard name used for the handler function is EvNewDocument. EvNewDocument takes a reference to the new TDocument-derived object and returns void.
    • The dnClose event when a document object is about to be closed. The standard name used for the handler function is EvCloseDocument. EvCloseDocument takes a reference to the TDocument-derived object that is being closed and returns void.

The response table entries and function declarations for these two macros would look like this:

.
.
.
.
.
.
END_RESPONSE_TABLE;
void EvNewDocument(TDocument& document);
void EvCloseDocument(TDocument& document);
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Definition eventhan.h:492
#define EV_OWLDOCUMENT(id, method)
Definition windowev.h:201
  • Use the EV_OWLVIEW macro to check for
    • The dnCreate event when a new view object is constructed. The standard name used for the handler function is EvNewView. EvNewView takes a reference to the new TView-derived object and returns void.
    • If the view contains a window interface element, either by inheritance or through a pointer, the interface element typically has not been created when the view is constructed. You can then modify the interface element's creation attributes before actually calling the Create function.
    • The dnClose event when a view object is destroyed. The standard name used for the handler function is EvCloseView. EvCloseView takes a reference to the
    • TView-derived object that is being destroyed and returns void.

The response table entries and function declarations for these two macros would look like this:

.
.
.
EV_OWLVIEW(dnCreate, EvNewView),
.
.
.
END_RESPONSE_TABLE;
void EvNewView(TView &view);
void EvCloseView(TView &view);
#define EV_OWLVIEW(id, method)
Definition windowev.h:202

See Also