📄 plcindlg.cpp
字号:
// PlcInDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "PlcInDlg.h"
#include "FLADS.h"
#include "PlcInIDlg.h"
#include "PlcIn2Dlg.h"
#include "PlcIn3Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPlcInDlg dialog
extern CFLADSApp theApp;
CPlcInDlg::CPlcInDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPlcInDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPlcInDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CPlcInDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPlcInDlg)
DDX_Control(pDX, IDC_CHECK4, m_check4);
DDX_Control(pDX, IDC_CHECK3, m_check3);
DDX_Control(pDX, IDC_CHECK2, m_check2);
DDX_Control(pDX, IDC_CHECK1, m_check1);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPlcInDlg, CDialog)
//{{AFX_MSG_MAP(CPlcInDlg)
ON_WM_LBUTTONUP()
ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
ON_BN_CLICKED(IDC_CHECK2, OnCheck2)
ON_BN_CLICKED(IDC_CHECK3, OnCheck3)
ON_BN_CLICKED(IDC_CHECK4, OnCheck4)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPlcInDlg message handlers
void CPlcInDlg::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnLButtonUp(nFlags, point);
}
void CPlcInDlg::OnCheck1()
{
// TODO: Add your control notification handler code here
if((m_check1.GetCheck()%2)!=0)
{
m_check1.SetCheck(1);
m_check2.SetCheck(0);
m_check3.SetCheck(0);
m_check4.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.type=0;
}else
{
m_check1.SetCheck(0);
m_check2.SetCheck(0);
m_check3.SetCheck(0);
m_check4.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.type=7;
}
}
void CPlcInDlg::OnCheck2()
{
// TODO: Add your control notification handler code here
if((m_check2.GetCheck()%2)!=0)
{
m_check1.SetCheck(0);
m_check2.SetCheck(1);
m_check3.SetCheck(0);
m_check4.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.type=1;
}else
{
m_check1.SetCheck(0);
m_check2.SetCheck(0);
m_check3.SetCheck(0);
m_check4.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.type=7;
}
}
void CPlcInDlg::OnCheck3()
{
// TODO: Add your control notification handler code here
if((m_check3.GetCheck()%2)!=0)
{
m_check1.SetCheck(0);
m_check2.SetCheck(0);
m_check3.SetCheck(1);
m_check4.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.type=2;
}else
{
m_check1.SetCheck(0);
m_check2.SetCheck(0);
m_check3.SetCheck(0);
m_check4.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.type=7;
}
}
BOOL CPlcInDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CString string;
int i,j;
string.Format(_T("%03d输入类型"),theApp.krnum+1);
SetDlgItemText(IDC_TYPE,string);
j=theApp.krnum;
i=theApp.yxtask.con_in[j].B.type;
switch(i)
{
case 0x00:m_check1.SetCheck(1);
m_check2.SetCheck(0);
m_check3.SetCheck(0);
m_check4.SetCheck(0);
break;
case 0x01:m_check1.SetCheck(0);
m_check2.SetCheck(1);
m_check3.SetCheck(0);
m_check4.SetCheck(0);
break;
case 0x02:m_check1.SetCheck(0);
m_check2.SetCheck(0);
m_check3.SetCheck(1);
m_check4.SetCheck(0);
break;
default: m_check1.SetCheck(0);
m_check2.SetCheck(0);
m_check3.SetCheck(0);
m_check4.SetCheck(1);
break;
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPlcInDlg::OnCheck4()
{
// TODO: Add your control notification handler code here
m_check1.SetCheck(0);
m_check2.SetCheck(0);
m_check3.SetCheck(0);
m_check4.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.type=7;
}
void CPlcInDlg::OnOK()
{
// TODO: Add extra validation here
CPlcINIDlg dlg1;
CPlcIn2Dlg dlg2;
CPlcIn3Dlg dlg3;
switch(theApp.yxtask.con_in[theApp.krnum].B.type)
{
case 0x00: dlg1.DoModal();
break;
case 0x01: dlg2.DoModal();
break;
case 0x02: dlg3.DoModal();
break;
default: break;
}
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -