84 lines
1.8 KiB
C++
84 lines
1.8 KiB
C++
// DoubleParamDialog.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "CDoubleParamWinApp.h"
|
|
#include "DoubleParamDialog.h"
|
|
|
|
|
|
// DoubleParamDialog dialog
|
|
|
|
IMPLEMENT_DYNAMIC(DoubleParamDialog, CDialog)
|
|
DoubleParamDialog::DoubleParamDialog(CKParameter *param, CWnd* pParent /*=NULL*/)
|
|
: CDialog(DoubleParamDialog::IDD, pParent)
|
|
{
|
|
parameter = param;
|
|
}
|
|
|
|
DoubleParamDialog::~DoubleParamDialog()
|
|
{
|
|
}
|
|
|
|
LRESULT DoubleParamDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
|
switch (message)
|
|
{
|
|
case WM_ERASEBKGND:
|
|
{
|
|
RECT r;
|
|
GetClientRect(&r);
|
|
CDC* pDC=CDC::FromHandle((HDC)wParam);
|
|
pDC->FillSolidRect(&r,RGB(200,200,200));
|
|
return 1;
|
|
}break;
|
|
case CKWM_OK:
|
|
{
|
|
CEdit *valueText = (CEdit*)GetDlgItem(IDC_EDIT);
|
|
CString l_strValue;
|
|
valueText->GetWindowText(l_strValue);
|
|
|
|
double d;
|
|
if (sscanf(l_strValue,"%Lf",&d)) {
|
|
parameter->SetValue(&d);
|
|
}
|
|
} break;
|
|
|
|
case CKWM_INIT:
|
|
{
|
|
char temp[64];
|
|
double d;
|
|
parameter->GetValue((void*)&d,FALSE);
|
|
sprintf(temp,"%Lf",d);
|
|
|
|
CEdit *valueText = (CEdit*)GetDlgItem(IDC_EDIT);
|
|
valueText->SetWindowText(temp);
|
|
} break;
|
|
}
|
|
return CDialog::WindowProc(message, wParam, lParam);
|
|
}
|
|
|
|
BOOL DoubleParamDialog::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
//do your initialization stuff here
|
|
|
|
editValue.SetEditStyle(VI_CTRL_EDIT_FLOAT);
|
|
|
|
editValue.Create(ES_CENTER|WS_VISIBLE|WS_CHILD|ES_AUTOHSCROLL, CRect(140,10,240,25), this, IDC_EDIT);
|
|
textValue.Create("Parameter (double) :", WS_VISIBLE|WS_CHILD, CRect(20,10,120,30), this, IDC_PARAM_NAME);
|
|
|
|
//end initialization stuff
|
|
|
|
return FALSE; //false don't set the focus on the value
|
|
}
|
|
|
|
void DoubleParamDialog::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(DoubleParamDialog, CDialog)
|
|
END_MESSAGE_MAP()
|
|
|