From 4a1d72850cf1d28c3f5f99f93dcb0136089a0918 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期二, 03 十二月 2024 16:34:33 +0800
Subject: [PATCH] 1.IO页面,上一页、下一页按钮根据页号禁用或启用; 2.PLC页,修复在连接前打开闪退的问题。同进根据连接状态启用或禁用按钮组;
---
SourceCode/Bond/BondEq/CComponentPLCDlg.cpp | 38 ++++++++++++++++++++++++++++++++++----
1 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/SourceCode/Bond/BondEq/CComponentPLCDlg.cpp b/SourceCode/Bond/BondEq/CComponentPLCDlg.cpp
index f56598b..d380353 100644
--- a/SourceCode/Bond/BondEq/CComponentPLCDlg.cpp
+++ b/SourceCode/Bond/BondEq/CComponentPLCDlg.cpp
@@ -38,6 +38,7 @@
ON_WM_SIZE()
ON_BN_CLICKED(IDC_BUTTON_PLC_AXIS_SETTINGS, &CComponentPLCDlg::OnBnClickedButtonAxisSetting)
ON_BN_CLICKED(IDC_BUTTON_PLC_IO, &CComponentPLCDlg::OnBnClickedButtonIO)
+ ON_WM_TIMER()
END_MESSAGE_MAP()
@@ -53,8 +54,19 @@
// onNext
pAny->addRef();
int code = pAny->getCode();
- if (RX_CODE_ALARM_EVENT == code) {
-
+ if (RX_CODE_PLC1_CONNECTTD == code) {
+ CComponent* pComponent;
+ if (pAny->getPtrValue("ptr", (void*&)pComponent)
+ && pComponent == m_pContext) {
+ EnableGroup1(TRUE);
+ }
+ }
+ else if (RX_CODE_PLC1_DISCONNECTTD == code) {
+ CComponent* pComponent;
+ if (pAny->getPtrValue("ptr", (void*&)pComponent)
+ && pComponent == m_pContext) {
+ EnableGroup1(FALSE);
+ }
}
pAny->release();
}, [&]() -> void {
@@ -72,12 +84,24 @@
BOOL CComponentPLCDlg::OnInitDialog()
{
CComponentDlg::OnInitDialog();
-
+ SetTimer(1, 200, NULL);
return TRUE; // return TRUE unless you set the focus to a control
// 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
}
+void CComponentPLCDlg::OnTimer(UINT_PTR nIDEvent)
+{
+ // TODO: 鍦ㄦ娣诲姞娑堟伅澶勭悊绋嬪簭浠g爜鍜�/鎴栬皟鐢ㄩ粯璁ゅ��
+ if (1 == nIDEvent) {
+ KillTimer(1);
+ InitRxWindows();
+ CPLC* pPLC = (CPLC*)m_pContext;
+ EnableGroup1(pPLC->isConnected());
+ }
+
+ CComponentDlg::OnTimer(nIDEvent);
+}
HBRUSH CComponentPLCDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
@@ -129,7 +153,7 @@
void CComponentPLCDlg::OnBnClickedButtonAxisSetting()
{
CAxisSettingsDlg axisDlg;
- axisDlg.SetPLC(theApp.m_model.getBonder().getPLC("PLC(1)"));
+ axisDlg.SetPLC((CPLC*)m_pContext);
axisDlg.SetRecipeName(_T("Default"));
axisDlg.DoModal();
}
@@ -142,3 +166,9 @@
dlg.DoModal();
}
+void CComponentPLCDlg::EnableGroup1(BOOL bEnable)
+{
+ GetDlgItem(IDC_BUTTON_PLC_AXIS_SETTINGS)->EnableWindow(bEnable);
+ GetDlgItem(IDC_BUTTON_PLC_IO)->EnableWindow(bEnable);
+}
+
--
Gitblit v1.9.3