Скачиваний:
7
Добавлен:
01.05.2014
Размер:
1.95 Кб
Скачать
// SetDlg.cpp : implementation file
//

#include "stdafx.h"
#include "part32.h"
#include "SetDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// SetDlg dialog


SetDlg::SetDlg(CWnd* pParent /*=NULL*/)
	: CDialog(SetDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(SetDlg)
	m_cnt = 0;
	m_name = _T("");
	m_y = 0;
	m_pos = 0;
	m_x = 0;
	m_num = 0;
	//}}AFX_DATA_INIT
	index=0;
}


void SetDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(SetDlg)
	DDX_Text(pDX, IDC_EDIT5, m_cnt);
	DDX_Text(pDX, IDC_EDIT4, m_name);
	DDX_Text(pDX, IDC_EDIT2, m_y);
	DDX_Text(pDX, IDC_EDIT3, m_pos);
	DDX_Text(pDX, IDC_EDIT1, m_x);
	DDX_Text(pDX, IDC_EDIT6, m_num);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(SetDlg, CDialog)
	//{{AFX_MSG_MAP(SetDlg)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// SetDlg message handlers

void SetDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
	if (index>0)
	{
		index--;
		ArSetIterator<Shape*> it(set);

		for (int i=0;i<index;i++)
		{it.next();}

		m_num=index+1;
		m_name=it.currentItem()->getName();
		m_x=it.currentItem()->getX();
		m_y=it.currentItem()->getY();
		m_pos=it.currentPos();

		UpdateData(false);
	}		
}

void SetDlg::OnButton2() 
{
	// TODO: Add your control notification handler code here
	if (index<m_cnt-1)
	{
		index++;
		ArSetIterator<Shape*> it(set);

		for (int i=0;i<index;i++)
		{it.next();}

		m_num=index+1;
		m_name=it.currentItem()->getName();
		m_x=it.currentItem()->getX();
		m_y=it.currentItem()->getY();
		m_pos=it.currentPos();

		UpdateData(false);
	}		
}
Соседние файлы в папке part32