<< Return to Main Index

< Return to Class Index

class CGXGridHandleView: public CView

The CGXGridHandleView class represents the grid-component as view.

CGXGridHandleView can be used either associated with a document or stand-alone.

All MFC features are supported:

- using the grid view in dynamic splitter windows.

- printing and print preview

- find and replace

- synchronizing several views when attached to the same document

CGXGridHandleView allows you to attach a CGXGridCore-derived class to a CView. The class differs from CGXGridView in that it maintains a reference to a CGXGridCore-derived object and delegates all mouse actions/user input to this object, whereas CGXGridView uses multiple inheritance.

The CGXGridHandleView offers you an alternative to the multiple inheritance approach of the other grid window classes.

CGXGridView lets you statically bind CGXGridCore-derived classes to CView/CView with multiple inheritance. That’s the way in which CGXGridViewCGXBrowserView and CGXDaoRecordView were implemented. Multiple inheritance has the advantage of allowing you to override virtual methods defined in CGXGridCore in classes derived from the grid window classes (e.g., a derivative from CGXGridView).

With CGXGridHandleView you can dynamically bind CGXGridCore-derived classes to CGXGridHandleView by calling AttachGrid.

The advantage of this technique is that CGXGridHandleView can be bound with any CGXGridCore-derived class at run time. It is not statically bound to a specific CGXGridCore-derived class as for example CGXGridView, CGXBrowserView or CGXDaoRecordView are. So, if you derive a class from CGXGridCore and you want to make your extensions available to both CView and CView derivatives, you can derive a class from CGXGridCore and attach it to CGXGridHandleView. See the example below.

Example

This example shows you how to attach a CGXBrowserGrid (derived from CGXGridCore) to CGXGridHandleView:

void CMyGridView::OnInitialUpdate()
{
   AttachGrid( new CGXBrowserGrid(this, GetDocument(), TRUE) );

   CGXGridHandleView::OnInitialUpdate();

   GetGrid()->SetRowCount(10);
   GetGrid()->SetColCount(10);

   ...
}

#include <gxall.h>

See Also

CGXGridView CGXGridCore

CGXGridHandleView

Class Members