class CGXGridWnd: public CWnd, public CGXGridCore

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

The easiest way to use a CGXGridWnd-derived class in a dialog is to use SubclassDlgItem. Here are the necessary steps:

  • Create a new class with ClassWizard. Use “generic CWnd” as Class Type.

  • Next, using a text editor, change the derivation in your window class, in both the .h and .cpp files. All references to CWnd should be replaced by CGXGridWnd.

  • Create or open your dialog template. Choose the user control icon, drag it into the dialog and open its property page. Enter “GXWND” as class name into the class box and specify the style bits for the grid:
    - 0x50b10000 to display both scrollbars and a border
    - 0x50810000 to display no scrollbars but a border
    See the definitions for windows style bits in your windows.h header file.

  • If you created a new dialog, you should now create your dialog class with ClassWizard.

  • Declare an object of your derived grid class in the dialog, as for example:
   class CDerGridDialog : public CDialog
   {
      ...
      CDerivedGridWnd m_wndGrid;
      ...
  • Add the OnInitDialog member to your dialog class (WM_INITDIALOG-message). In OnInitDialog, you can initialize the grid:
   BOOL CDerivedGridDialog::OnInitDialog()
   {
      CDialog::OnInitDialog();
      m_wndGrid.SubclassDlgItem(IDC_GRIDSAMPLE, this);
      m_wndGrid.Initialize();
      ...
  • Now you can compile the class and test it.

#include <gxall.h>

See Also

 CGXTabWnd  CGXGridCore  GRID_DECLARE_REGISTER

CGXGridWnd

 Class Members