📄 plcin0dlg.cpp
字号:
// PlcIn0Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "PlcIn0Dlg.h"
#include "FLADS.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPlcIn0Dlg dialog
extern CFLADSApp theApp;
CPlcIn0Dlg::CPlcIn0Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CPlcIn0Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPlcIn0Dlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CPlcIn0Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPlcIn0Dlg)
DDX_Control(pDX, IDC_PART8, m_pin8);
DDX_Control(pDX, IDC_PART7, m_pin7);
DDX_Control(pDX, IDC_PART6, m_pin6);
DDX_Control(pDX, IDC_PART5, m_pin5);
DDX_Control(pDX, IDC_PART4, m_pin4);
DDX_Control(pDX, IDC_PART3, m_pin3);
DDX_Control(pDX, IDC_PART2, m_pin2);
DDX_Control(pDX, IDC_PART1, m_pin1);
DDX_Control(pDX, IDC_NENABLE, m_nenable);
DDX_Control(pDX, IDC_SET_ENABLE, m_set_enable);
DDX_Control(pDX, IDC_OR_ENABLE, m_or_enable);
DDX_Control(pDX, IDC_CLR_ENABLE, m_clr_enable);
DDX_Control(pDX, IDC_AND_ENABLE, m_and_enable);
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPlcIn0Dlg, CDialog)
//{{AFX_MSG_MAP(CPlcIn0Dlg)
ON_BN_CLICKED(IDC_AND_ENABLE, OnAndEnable)
ON_BN_CLICKED(IDC_OR_ENABLE, OnOrEnable)
ON_BN_CLICKED(IDC_SET_ENABLE, OnSetEnable)
ON_BN_CLICKED(IDC_CLR_ENABLE, OnClrEnable)
ON_BN_CLICKED(IDC_NENABLE, OnNenable)
ON_BN_CLICKED(IDC_PART1, OnPart1)
ON_BN_CLICKED(IDC_PART2, OnPart2)
ON_BN_CLICKED(IDC_PART3, OnPart3)
ON_BN_CLICKED(IDC_PART4, OnPart4)
ON_BN_CLICKED(IDC_PART5, OnPart5)
ON_BN_CLICKED(IDC_PART6, OnPart6)
ON_BN_CLICKED(IDC_PART7, OnPart7)
ON_BN_CLICKED(IDC_PART8, OnPart8)
ON_EN_CHANGE(IDC_EDIT_PIN1, OnChangeEditPin1)
ON_EN_CHANGE(IDC_EDIT_PIN2, OnChangeEditPin2)
ON_EN_CHANGE(IDC_EDIT_PIN3, OnChangeEditPin3)
ON_EN_CHANGE(IDC_EDIT_PIN4, OnChangeEditPin4)
ON_EN_CHANGE(IDC_EDIT_PIN5, OnChangeEditPin5)
ON_EN_CHANGE(IDC_EDIT_PIN6, OnChangeEditPin6)
ON_EN_CHANGE(IDC_EDIT_PIN8, OnChangeEditPin8)
ON_EN_CHANGE(IDC_EDIT_PIN7, OnChangeEditPin7)
ON_EN_CHANGE(IDC_SUM, OnChangeSum)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPlcIn0Dlg message handlers
BOOL CPlcIn0Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
int i;
CString string;
switch(theApp.yxtask.con_in[theApp.krnum].B.log_enable)
{
case 0:m_and_enable.SetCheck(1);
m_or_enable.SetCheck(0);
m_set_enable.SetCheck(0);
m_clr_enable.SetCheck(0);
break;
case 1:m_and_enable.SetCheck(0);
m_or_enable.SetCheck(1);
m_set_enable.SetCheck(0);
m_clr_enable.SetCheck(0);
break;
case 2:m_and_enable.SetCheck(0);
m_or_enable.SetCheck(0);
m_set_enable.SetCheck(1);
m_clr_enable.SetCheck(0);
break;
case 3:m_and_enable.SetCheck(0);
m_or_enable.SetCheck(0);
m_set_enable.SetCheck(0);
m_clr_enable.SetCheck(1);
break;
}
m_nenable.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.kgbf);
i=(int)theApp.yxtask.con_in[theApp.krnum].B.unit_num;
string.Format(_T("%3d"),i+1);
SetDlgItemText(IDC_SUM,string);
m_pin1.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u0_kgbf);
m_pin2.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u1_kgbf);
m_pin3.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u2_kgbf);
m_pin4.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u3_kgbf);
m_pin5.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u4_kgbf);
m_pin6.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u5_kgbf);
m_pin7.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u6_kgbf);
m_pin8.SetCheck((int)theApp.yxtask.con_in[theApp.krnum].B.u7_kgbf);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][0]+1);
SetDlgItemText(IDC_EDIT_PIN1,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][1]+1);
SetDlgItemText(IDC_EDIT_PIN2,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][2]+1);
SetDlgItemText(IDC_EDIT_PIN3,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][3]+1);
SetDlgItemText(IDC_EDIT_PIN4,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][4]+1);
SetDlgItemText(IDC_EDIT_PIN5,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][5]+1);
SetDlgItemText(IDC_EDIT_PIN6,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][6]+1);
SetDlgItemText(IDC_EDIT_PIN7,string);
string.Format(_T("%3d"),(int)theApp.yxtask.us[theApp.krnum][7]+1);
SetDlgItemText(IDC_EDIT_PIN8,string);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPlcIn0Dlg::OnAndEnable()
{//与门
// TODO: Add your control notification handler code here
if((m_and_enable.GetCheck()%2)!=0)
{
m_and_enable.SetCheck(1);
m_or_enable.SetCheck(0);
m_set_enable.SetCheck(0);
m_clr_enable.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=0;
}else
{
m_and_enable.SetCheck(0);
m_or_enable.SetCheck(0);
m_set_enable.SetCheck(0);
m_clr_enable.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=3;
}
}
void CPlcIn0Dlg::OnOrEnable()
{//或门
// TODO: Add your control notification handler code here
if((m_or_enable.GetCheck()%2)!=0)
{
m_and_enable.SetCheck(0);
m_or_enable.SetCheck(1);
m_set_enable.SetCheck(0);
m_clr_enable.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=1;
}else
{
m_and_enable.SetCheck(0);
m_or_enable.SetCheck(0);
m_set_enable.SetCheck(0);
m_clr_enable.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=3;
}
}
void CPlcIn0Dlg::OnSetEnable()
{//设置
// TODO: Add your control notification handler code here
if((m_set_enable.GetCheck()%2)!=0)
{
m_and_enable.SetCheck(0);
m_or_enable.SetCheck(0);
m_set_enable.SetCheck(1);
m_clr_enable.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=2;
}else
{
m_and_enable.SetCheck(0);
m_or_enable.SetCheck(0);
m_set_enable.SetCheck(0);
m_clr_enable.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=3;
}
}
void CPlcIn0Dlg::OnClrEnable()
{//清零
// TODO: Add your control notification handler code here
if((m_clr_enable.GetCheck()%2)!=0)
{
m_and_enable.SetCheck(0);
m_or_enable.SetCheck(0);
m_set_enable.SetCheck(0);
m_clr_enable.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=3;
}else
{
m_and_enable.SetCheck(1);
m_or_enable.SetCheck(0);
m_set_enable.SetCheck(0);
m_clr_enable.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.log_enable=0;
}
}
void CPlcIn0Dlg::OnNenable()
{//取反
// TODO: Add your control notification handler code here
if((m_nenable.GetCheck()%2)!=0)
{
m_nenable.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.kgbf=1;
}else
{
m_nenable.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.kgbf=0;
}
}
void CPlcIn0Dlg::OnPart1()
{//子项1
// TODO: Add your control notification handler code here
if((m_pin1.GetCheck()%2)!=0)
{
m_pin1.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.u0_kgbf=1;
}else
{
m_pin1.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.u0_kgbf=0;
}
}
void CPlcIn0Dlg::OnPart2()
{//子项2
// TODO: Add your control notification handler code here
if((m_pin2.GetCheck()%2)!=0)
{
m_pin2.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.u1_kgbf=1;
}else
{
m_pin2.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.u1_kgbf=0;
}
}
void CPlcIn0Dlg::OnPart3()
{//子项3
// TODO: Add your control notification handler code here
if((m_pin3.GetCheck()%2)!=0)
{
m_pin3.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.u2_kgbf=1;
}else
{
m_pin3.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.u2_kgbf=0;
}
}
void CPlcIn0Dlg::OnPart4()
{//子项4
// TODO: Add your control notification handler code here
if((m_pin4.GetCheck()%2)!=0)
{
m_pin4.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.u3_kgbf=1;
}else
{
m_pin4.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.u3_kgbf=0;
}
}
void CPlcIn0Dlg::OnPart5()
{//子项5
// TODO: Add your control notification handler code here
if((m_pin5.GetCheck()%2)!=0)
{
m_pin5.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.u4_kgbf=1;
}else
{
m_pin5.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.u4_kgbf=0;
}
}
void CPlcIn0Dlg::OnPart6()
{//子项6
// TODO: Add your control notification handler code here
if((m_pin6.GetCheck()%2)!=0)
{
m_pin6.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.u5_kgbf=1;
}else
{
m_pin6.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.u5_kgbf=0;
}
}
void CPlcIn0Dlg::OnPart7()
{//子项7
// TODO: Add your control notification handler code here
if((m_pin7.GetCheck()%2)!=0)
{
m_pin7.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.u6_kgbf=1;
}else
{
m_pin7.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.u6_kgbf=0;
}
}
void CPlcIn0Dlg::OnPart8()
{//子项8
// TODO: Add your control notification handler code here
if((m_pin8.GetCheck()%2)!=0)
{
m_pin8.SetCheck(1);
theApp.yxtask.con_in[theApp.krnum].B.u7_kgbf=1;
}else
{
m_pin8.SetCheck(0);
theApp.yxtask.con_in[theApp.krnum].B.u7_kgbf=0;
}
}
void CPlcIn0Dlg::OnChangeEditPin1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_CHANGE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
unsigned short wBuf[32];
int j;
CString string;
/* GetDlgItemText(IDC_EDIT_PIN1,wBuf,20);
j=_wtoi(wBuf);
if(j>256) j=256;
if(j<=0) j=1;
theApp.yxtask.us[theApp.krnum][0]=j-1;
string.Format(_T("%3d"),j);
SetDlgItemText(IDC_EDIT_PIN1,string);
*/
}
void CPlcIn0Dlg::OnChangeEditPin2()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_CHANGE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
}
void CPlcIn0Dlg::OnChangeEditPin3()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_CHANGE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
}
void CPlcIn0Dlg::OnChangeEditPin4()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_CHANGE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
}
void CPlcIn0Dlg::OnChangeEditPin5()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_CHANGE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
}
void CPlcIn0Dlg::OnChangeEditPin6()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_CHANGE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
}
void CPlcIn0Dlg::OnChangeEditPin8()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_CHANGE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
}
void CPlcIn0Dlg::OnChangeEditPin7()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_CHANGE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
}
void CPlcIn0Dlg::OnChangeSum()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_CHANGE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
unsigned short wBuf[32];
int j;
CString string;
GetDlgItemText(IDC_SUM,wBuf,20);
j=_wtoi(wBuf);
if(j>8) j=8;
if(j<=0) j=1;
theApp.yxtask.con_in[theApp.krnum].B.unit_num=j-1;
string.Format(_T("%3d"),j);
SetDlgItemText(IDC_SUM,string);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -