A SERVICE OF

logo

interface object classes. Y ur new view class is locked into a single type ofo
interface element.
Like most other objects, TView provides functions that let you safely close
Closing a view
and destroy the object.
~TView does fairly little. It calls its associated document’ DetachViews
function, thus removing itself from the document’ list of views.s
TView also provides a CanClose function, which calls its associated
document’ CanClose function. Therefore the view’ ability to close dependss s
on the document’ ability to close.s
Doc/View event handling
Y u should normally handle Doc/View events through both theo
application object and your view’ interface element. Y u can either controls o
the view’ display through a pointer to an interface object or mix thes
functionality of the interface object with a view class (see page 215 for
details on constructing an interface element).
Y u can find more information about event handling and response tables ino
an ObjectWindows application in Chapter 5.
The application object generally handles only a few events, indicating when
Doc/View event
a document or a view has been created or destroyed. The dnCreate event is
handling in the
posted whenever a view or document is created. The dnClose event is
application object
posted whenever a view or document is closed.
T set up response table entries for these events, add theo
EV_OWLDOCUMENT and EV_OWLVIEW macros to your response table:
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.
Chapter 9, Doc/View objects
217