// DlgSimpleInput.cpp : implementation file
//

#include "stdafx.h"
#include "6046dryend.h"
#include "DlgSimpleInput.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgSimpleInput dialog


CDlgSimpleInput::CDlgSimpleInput(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgSimpleInput::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgSimpleInput)
	m_strInput = _T("");
	//}}AFX_DATA_INIT

	min	= 0;
	max = 180;
}


void CDlgSimpleInput::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgSimpleInput)
	DDX_Control(pDX, IDC_INPUT, m_ctrlInput);
	DDX_Text(pDX, IDC_INPUT, m_strInput);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgSimpleInput, CDialog)
	//{{AFX_MSG_MAP(CDlgSimpleInput)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgSimpleInput message handlers

void CDlgSimpleInput::OnOK() 
{
	
	m_ctrlInput.GetWindowText(inputBuff, 100);
	
	double test = atoi(inputBuff);
	if(test < min || test > max)
	{
		AfxMessageBox("Value Out Of Range!");
		return;
	}

	CDialog::OnOK();
}

BOOL CDlgSimpleInput::PreTranslateMessage(MSG* pMsg) 
{
	if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE)
	{
		return TRUE ;
	}
	
	return CDialog::PreTranslateMessage(pMsg);
}

void CDlgSimpleInput::SetMinMax(float min, float max)
{
	min = min;
	max = max;
}


double	CDlgSimpleInput::GetValue()
{
	return atoi(inputBuff);
}