// EnumValDlg.cpp : implementation file
//

#include "stdafx.h"
#include "EnumValDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CEnumValDlg dialog


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


void CEnumValDlg::DoDataExchange(CDataExchange* pDX)
{
	CaplTranslateDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CEnumValDlg)
	DDX_Control(pDX, IDC_VALUE, m_value);
	DDX_Control(pDX, IDCANCEL, m_cancel_btn);
	DDX_Control(pDX, IDOK, m_ok_btn);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CEnumValDlg, CaplTranslateDialog)
	//{{AFX_MSG_MAP(CEnumValDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CEnumValDlg message handlers

BOOL CEnumValDlg::OnInitDialog() 
{
	CaplTranslateDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_cancel_btn.SetIcon(GetAplStdIco16(APLSTDICO_CANCEL));
	m_cancel_btn.SetFlat(FALSE);
	m_ok_btn.SetIcon(GetAplStdIco16(APLSTDICO_OK));
	m_ok_btn.SetFlat(FALSE);

	for(int i=0; i<m_values.GetSize();i++)
		m_value.AddString(m_values[i]);
	m_value.SelectString(0,m_val);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CEnumValDlg::OnOK() 
{
	// TODO: Add extra validation here

	m_value.GetWindowText(m_val);
	if(m_val==_T(""))
	{
		AfxMessageBox( APL_T("Значение не выбрано !"));return;
	}
	
	CaplTranslateDialog::OnOK();
}
