Click here to Skip to main content
15,881,658 members
Articles / Desktop Programming / MFC

Data Driven UI Behavior Model

Rate me:
Please Sign up or sign in to vote.
3.24/5 (14 votes)
21 Oct 20034 min read 60.8K   551   25  
How to model a Data Driven UI Behavior Model in MFC to solve 'Everything in One Screen' requirement
// MyComboBox.cpp : implementation file
//

#include "stdafx.h"
#include "UpdateFromData.h"
#include "MyComboBox.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyComboBox

CMyComboBox::CMyComboBox()
{
}

CMyComboBox::~CMyComboBox()
{
}


BEGIN_MESSAGE_MAP(CMyComboBox, CComboBox)
	//{{AFX_MSG_MAP(CMyComboBox)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyComboBox message handlers
int CMyComboBox::AddItemWithData(CString caption, DWORD data)
{
	int index = -1;
	index = AddString(caption);
	if(index >= 0)
	{
		SetItemData(index, data);
	}
	return index;
}

void CMyComboBox::Dump()
{
	CString text;
	for(int index=0; index<GetCount(); index++)
	{
		GetLBText(index, text);
		TRACE(_T("(%d, %s, %d)\n"), index, text,GetItemData(index));
	}
}

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.


Written By
Software Developer (Senior) www.wonga.com
Ireland Ireland
I have over 13 Years IT industry experience as Principle/Senior Programmer. I am experienced in .NET/J2EE system design and detailed implementation. I master UML modelling and OO design methodology with a strong C#/C++/Java coding background. I have been in working/managing a distributed project using Agile/Waterfall approach. My business knowledge includes Telecommunication, Financial Investment/Trading, and Banking.

Comments and Discussions