Click here to Skip to main content
15,892,161 members
Articles / Desktop Programming / MFC

SuperGrid - Yet Another listview control

Rate me:
Please Sign up or sign in to vote.
4.77/5 (98 votes)
8 Dec 1999CPOL3 min read 1M   11.4K   345  
A combination list control and tree control with checkbox capability
// TestTreeDlg.cpp : implementation file
//

#include "stdafx.h"
#include "SuperGrid.h"
#include "TestTreeDlg.h"
#include "NewItem.h"
#include "SuperGridCtrl.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTestTreeDlg dialog


CTestTreeDlg::CTestTreeDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CTestTreeDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CTestTreeDlg)
	//}}AFX_DATA_INIT
}


void CTestTreeDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTestTreeDlg)
	DDX_Control(pDX, IDC_STATIC_FRAME, m_Frame);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTestTreeDlg, CDialog)
	//{{AFX_MSG_MAP(CTestTreeDlg)
	ON_BN_CLICKED(IDC_BUTTON_INSERT, OnButtonInsert)
	ON_WM_CREATE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTestTreeDlg message handlers

BOOL CTestTreeDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CRect rc;
	m_Frame.GetWindowRect(rc);
	ScreenToClient(rc);
	m_Frame.ShowWindow(SW_HIDE);
	if(m_List.GetSafeHwnd())
			m_List.MoveWindow(rc);

	return TRUE;  
	              
}


void CTestTreeDlg::OnButtonInsert() 
{
	int nIndex = m_List.GetSelectedItem();
	if(nIndex!=-1)
	{
		CNewItem dlg;
		if(dlg.DoModal()==IDOK)
			m_List.HowToInsertItemsAfterTheGridHasBeenInitialized(nIndex, dlg.m_strItem);
	}
}


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

	m_List.Create(WS_CHILD | WS_VISIBLE | WS_TABSTOP, CRect(0,0,0,0),this,0x1001);	
	m_List.InitializeGrid();
	m_List.SetExtendedStyle(0);
	m_List.ModifyStyleEx(0,WS_EX_CLIENTEDGE);
	return 0;
}


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Switzerland Switzerland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions