📄 diawarnset.cpp
字号:
// DiaWarnSet.cpp : implementation file
//
#include "stdafx.h"
#include "realev.h"
#include "DiaWarnSet.h"
#include "RealEvView.h"
#include "mainfrm.h"
#include "evtdb.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDiaWarnSet dialog
CDiaWarnSet::CDiaWarnSet(CWnd* pParent /*=NULL*/,evtdb* pdb)
: CDialog(CDiaWarnSet::IDD, pParent)
{
m_pEvtDb = pdb;
m_warntime = m_pEvtDb->warntime;
//{{AFX_DATA_INIT(CDiaWarnSet)
m_Time1 = 0.0f;
m_Time2 = 0.0f;
//}}AFX_DATA_INIT
}
void CDiaWarnSet::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDiaWarnSet)
DDX_Control(pDX, IDC_EDIT1, m_edit);
DDX_Control(pDX, IDC_CHECK1, m_check1);
DDX_Text(pDX, IDC_EDIT1, m_warntime);
DDV_MinMaxInt(pDX, m_warntime, 0, 7);
DDX_Control(pDX, IDC_COMBO1, m_ComboBox);
DDX_Text(pDX, IDC_EDIT3, m_Time1);
DDV_MinMaxFloat(pDX, m_Time1, 0.5f, 10.f);
DDX_Text(pDX, IDC_EDIT4, m_Time2);
DDV_MinMaxFloat(pDX, m_Time2, 0.f, 20.f);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDiaWarnSet, CDialog)
//{{AFX_MSG_MAP(CDiaWarnSet)
ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDiaWarnSet message handlers
void CDiaWarnSet::OnCheck1()
{
// TODO: Add your control notification handler code here
if(m_pEvtDb->warntimes)
{
m_pEvtDb->warntimes=FALSE;
m_edit.SetReadOnly(true);
}
else
{
m_pEvtDb->warntimes=TRUE;
m_edit.SetReadOnly(false);
}
}
BOOL CDiaWarnSet::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_ComboBox.InsertString(0,"未确认事件");
m_ComboBox.InsertString(1,"最新一条事件");
m_ComboBox.InsertString(2,"最新两条事件");
m_ComboBox.InsertString(3,"最新三条事件");
m_ComboBox.SetCurSel(g_NumT);
m_Time1=g_TimeC;
m_Time2=g_TimeT;
m_warntime=g_NumC;
if(m_pEvtDb->warntimes==0)
{
m_check1.SetCheck(2);
m_edit.SetReadOnly(true);
}
else
{
m_check1.SetCheck(0);
m_edit.SetReadOnly(false);
}
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDiaWarnSet::OnOK()
{
UpdateData(true);
if(1==m_check1.GetCheck ())
g_NumC=0;
else g_NumC=m_warntime;
g_NumT=m_ComboBox.GetCurSel();
g_TimeC=m_Time1;
g_TimeT=m_Time2;
m_pEvtDb->SetSave();
CDialog::OnOK();
}
void CDiaWarnSet::OnSelchangeCombo1()
{
// TODO: Add your control notification handler code here
//AfxMessageBox("^_^");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -