Click here to Skip to main content
15,886,873 members
Articles / Desktop Programming / MFC

Another Report List Control

Rate me:
Please Sign up or sign in to vote.
4.89/5 (95 votes)
31 Dec 20036 min read 1.3M   17.4K   235  
A report style CListCtrl supporting sorting, sub-item editing, sub-item image, sub-item color etc.
// StatesDlg.cpp : implementation file
//

#include "stdafx.h"
#include "reportctrldemo.h"
#include "StatesDlg.h"
#include "ReportCtrl.h"


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

/////////////////////////////////////////////////////////////////////////////
// CStatesDlg dialog


CStatesDlg::CStatesDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CStatesDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CStatesDlg)
	m_bAll = FALSE;
	m_bChecked = FALSE;
	m_bFocused = FALSE;
	m_bSelected = FALSE;
	m_bUnfocused = FALSE;
	m_bUnchecked = FALSE;
	m_bUnselected = FALSE;
	//}}AFX_DATA_INIT
	m_dwStates = RC_ITEM_NONE;
}


void CStatesDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CStatesDlg)
	DDX_Check(pDX, IDC_ALL, m_bAll);
	DDX_Check(pDX, IDC_CHECKED, m_bChecked);
	DDX_Check(pDX, IDC_FOCUSED, m_bFocused);
	DDX_Check(pDX, IDC_SELECTED, m_bSelected);
	DDX_Check(pDX, IDC_UNFOCUSED, m_bUnfocused);
	DDX_Check(pDX, IDC_UNCHECKED, m_bUnchecked);
	DDX_Check(pDX, IDC_UNSELECTED, m_bUnselected);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CStatesDlg, CDialog)
	//{{AFX_MSG_MAP(CStatesDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStatesDlg message handlers

void CStatesDlg::OnOK() 
{
	// TODO: Add extra validation here
	m_dwStates = RC_ITEM_NONE;
	UpdateData(TRUE);
	if (m_bAll)
		m_dwStates |= RC_ITEM_ALL;

	if (m_bSelected)
		m_dwStates |= RC_ITEM_SELECTED;

	if (m_bUnselected)
		m_dwStates |= RC_ITEM_UNSELECTED;

	if (m_bChecked)
		m_dwStates |= RC_ITEM_CHECKED;

	if (m_bUnchecked)
		m_dwStates |= RC_ITEM_UNCHECKED;

	if (m_bFocused)
		m_dwStates |= RC_ITEM_FOCUSED;

	if (m_bUnfocused)
		m_dwStates |= RC_ITEM_UNFOCUSED;

	EndDialog(IDOK);
}

DWORD CStatesDlg::GetStates() const
{
	return m_dwStates;
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


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

Comments and Discussions