From 526a56428d2111aef216cfca5bc63c806048a0e6 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 13 一月 2025 16:54:42 +0800
Subject: [PATCH] 1.PLC连接状态在最左侧树控件中的小圆点展示; 2.当前PLC名称修改为CPLC指针;
---
SourceCode/Bond/BoounionPLC/PagePlcList.cpp | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/BoounionPLC/PagePlcList.cpp b/SourceCode/Bond/BoounionPLC/PagePlcList.cpp
index 56b9ff5..fd94ec0 100644
--- a/SourceCode/Bond/BoounionPLC/PagePlcList.cpp
+++ b/SourceCode/Bond/BoounionPLC/PagePlcList.cpp
@@ -85,6 +85,18 @@
theApp.m_model.notifyPtr(RX_CODE_SELECT_PLC, pSelectedPlc);
}
}
+ else if (RX_PLC_STATE_CHANGED == code) {
+ CPLC* pPlc;
+ if (pAny->getPtrValue("ptr", (void*&)pPlc)) {
+ HTREEITEM hItem = FindItem(pPlc);
+ if (hItem != nullptr && pPlc->isConnected()) {
+ m_treeCtrl.ShowItemBadgeDotMode(hItem);
+ }
+ else {
+ m_treeCtrl.HideItemBadge(hItem);
+ }
+ }
+ }
pAny->release();
}, [&]() -> void {
@@ -191,6 +203,10 @@
for (auto item : plcs) {
HTREEITEM hItem = m_treeCtrl.InsertItem(item.second->getName().c_str(), nullptr, nullptr);
m_treeCtrl.SetItemData(hItem, (DWORD_PTR)item.second);
+ m_treeCtrl.SetItemBadge(hItem, TREE_BADGE_BACKGROUND, TREE_BADGE_FOREGROUND);
+ if (item.second->isConnected()) {
+ m_treeCtrl.ShowItemBadgeDotMode(hItem);
+ }
if (hItemFirst == nullptr) {
hItemFirst = hItem;
}
--
Gitblit v1.9.3