<< Return to Main Index

< Return to Class Index

class CGXGridHandleWnd: public CWnd

The CGXGridHandleWnd class represents the grid component as child control. CGXGridHandleWnd can be easily used as dialog control or in a workbook window.

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

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

CGXGridWnd lets you statically bind CGXGridCore-derived classes to CView/CWnd with multiple inheritance. That’s the technique how CGXGridWndCGXBrowserWnd and CGXDaoRecordWnd 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 CGXGridWnd).

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

The advantage of this technique is that CGXGridHandleWnd can be bound with any CGXGridCore-derived class at runtime. It is not statically bound to a specific CGXGridCore-derived classes as for example CGXGridWnd, CGXBrowserWnd or CGXDaoRecordWnd are. So, if you derive a class from CGXGridCore and you want to make your extensions available to both CWnd and CView derivatives, you can derive a class from CGXGridCore and attach it to CGXGridHandleWnd. See the example below.

See the CGXGridWnd class for methods regarding the Workbook/Worksheet interface or registering the window class.

Example

This example shows you how to subclass a dialog item with a CGXGridHandleWnd and then attach a CGXBrowserGrid (derived from CGXGridCore) to it:

class CMyDialog
{
   CGXGridHandleWnd m_wndGrid;

   ...
}

void CMyDialog::OnInitDialog()
{
   m_wndGrid.SubclassDlgItem(IDC_GRID, this);
   m_wndGrid.AttachGrid(new CGXBrowserGrid(&m_wndGrid));
   m_wndGrid.Initialize();
   m_wndGrid.GetGrid()->SetRowCount(10);
   m_wndGrid.GetGrid()->SetColCount(10);

   ...
}

#include <gxall.h>

See Also

CGXGridWnd CGXGridCore

CGXGridHandleWnd

Class Members