Click here to Skip to main content
15,885,757 members
Articles / Desktop Programming / MFC

An Interactive Periodic Table of the Elements

Rate me:
Please Sign up or sign in to vote.
4.81/5 (22 votes)
4 Oct 20032 min read 120.5K   2.5K   34  
An article using GDI to create a scalable periodic table of the elements
// cElementDetails.cpp : implementation file
//

#include "stdafx.h"
#include "PeriodicTable.h"
#include "cElementDetails.h"

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

/////////////////////////////////////////////////////////////////////////////
// cElementDetails dialog


cElementDetails::cElementDetails(CWnd* pParent /*=NULL*/)
	: CDialog(cElementDetails::IDD, pParent)
{
	//{{AFX_DATA_INIT(cElementDetails)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void cElementDetails::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(cElementDetails)
	DDX_Control(pDX, IDC_PERIOD, m_Period);
	DDX_Control(pDX, IDC_GROUPNUMBER, m_GroupNumber);
	DDX_Control(pDX, IDC_GROUPNAME, m_GroupName);
	DDX_Control(pDX, IDC_ELEMENTSYMBOL, m_ElementSymbol);
	DDX_Control(pDX, IDC_ELEMENTNAME, m_ElementName);
	DDX_Control(pDX, IDC_DISCOVERYDATE, m_DiscoveryDate);
	DDX_Control(pDX, IDC_DISCOVERERNAME, m_DiscovererName);
	DDX_Control(pDX, IDC_CASREGISTRYID, m_CASRegistryID);
	DDX_Control(pDX, IDC_BLOCK, m_Block);
	DDX_Control(pDX, IDC_ATOMICWEIGHT, m_AtomicWeight);
	DDX_Control(pDX, IDC_ATOMICNUMBER, m_AtomicNumber);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// cElementDetails message handlers
/* ************************************** */
/* Dialog initialization                  */
/* ************************************** */
BOOL cElementDetails::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// CurrentElement is assigned prior to this dialog box being opened
	m_Period.SetWindowText(CurrentElement.GetPeriod());
	m_GroupNumber.SetWindowText(CurrentElement.GetGroupNumber());
	m_GroupName.SetWindowText(CurrentElement.GetGroupName());
	m_ElementSymbol.SetWindowText(CurrentElement.GetElementSymbol());
	m_ElementName.SetWindowText(CurrentElement.GetElementName());
	m_DiscoveryDate.SetWindowText(CurrentElement.GetDiscoveryDate());
	m_DiscovererName.SetWindowText(CurrentElement.GetDiscovererName());
	m_CASRegistryID.SetWindowText(CurrentElement.GetCASRegistryID());
	m_Block.SetWindowText(CurrentElement.GetBlock());
	m_AtomicWeight.SetWindowText(CurrentElement.GetAtomicWeight());
	m_AtomicNumber.SetWindowText(CurrentElement.GetAtomicNumber());
	
	return TRUE;  
}

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
Web Developer
United States United States
I'm an ENTP personality type, Ex Army Ranger, former software design engineer for Hewlett-Packard's TV network and now self employed.

Best job: Golf caddy in high school
Worst job: Tele-marketer

Countries Lived in, or visited: USA, Mexico, South Korea, Canada, Japan, North Korea (for 10 seconds), Spain, Germany, Bahrain, Iraq, Saudi Arabia & Panama

Hobbies: Classical Guitar, Video Games, Golf, Pool, Beer, 1/48 scale WWII airplane models, Reading & B-Movies

Comments and Discussions