ALXSoft

Utilities, source code, examples for programmers on Visual C ++

Home
News
ALXGrid Control
Samples
Documentation
Download
alxBASE library
Samples
Documentation
Download
DBFRead utility
Download
DBFNavigator utility
Download
IDXView utility
Download
MDXView utility
Download
NDXView utility
Download
NTXView utility
Download
NSXView utility
Download
Links

Russian version

Sample "GridDlg"
GridDlg window

    Sample of use grid in dialog windows.

There are two ways of creation of a grid window in dialog window.

1. To create the user control (Custom Control). To enter into a field "Class" a name of your class (a parental class should be CALXGridCtrl). But before initialization of dialog windows this class should be registered.

For example:

CRegGridDLG::CRegGridDLG(CWnd* pParent /*=NULL*/)
    : CDialog(CRegGridDLG::IDD, pParent)
{
    if (!CRegGridCtrl::RegisterClass())
    {
        TRACE0("Failed to register grid control\n");
        return;
    }
    //{{AFX_DATA_INIT(CRegGridDLG)
        // NOTE: the ClassWizard will add member initialization here
    //}}AFX_DATA_INIT
}

CRegGridDLG::~CRegGridDLG()
{
    CRegGridCtrl::UnregisterClass();
}

( in a heading file should be declared macros DECLARE_REGISTER, and in cpp macros IMPLEMENT_REGISTER)

2. It is possible also used function Create (), which itself will register your class.

int CCrGridDLG::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CDialog::OnCreate(lpCreateStruct) == -1)
        return -1;

    if (!m_GridCtrl.Create( WS_EX_STATICEDGE,
                            WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | AGS_FLAT,
                CRect(7,7,410,220),
                            this,
            0))
    {
        TRACE0("Failed to create list box\n");
        return -1;
    }
   
   return 0;
}

Alexey. E-mail: alxsoft@gazinter.net

Hosted by uCoz