OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Adding Functionality To Views

TView contains some pure virtual functions that you must provide in every new view class.

It also contains a few placeholder functions that have no base class functionality. You need to provide new versions of these functions if you plan to use them for anything.

Much like TDocument, you should not override a TView function unless that function is a virtual. When functions in TDocument call functions in your view, they address the view object as a TView. If you override a nonvirtual function and the document calls that function, the document actually calls the TView version of that function, rendering your function useless in that context.

TView Virtual Functions

The following functions are declared virtual so you can override them to provide some useful functionality. But most are not declared as pure virtuals; you are not required to override them to construct a view. Instead, you need to override these functions only if you plan to use them.

  • TView::GetViewName() returns the static name of the view. This function is declared as a pure virtual function; you must provide a definition of this function in your view class.
  • TView::GetWindow() returns a TWindow * that should reference the view's associated interface object if it has one; otherwise, GetWindow returns 0.
  • TView::SetDocTitle() sets the view window's caption. It should be set to call the SetDocTitle function in the interface object.

Adding a Menu

TView contains the private TMenuDescr * data member ViewMenu. You can assign any existing TMenuDescr object to this member. Normally you set the menu up in the view's constructor to make it merge with the frame window's menu when the view is activated.

See Also