From bb13ecc602edb0247f65a1362135e4ef70a5a79f Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 06 六月 2025 13:50:15 +0800
Subject: [PATCH] Merge branch 'master' into clh

---
 SourceCode/Bond/Servo/CRobotCmdContainerDlg.cpp |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/SourceCode/Bond/Servo/CRobotCmdContainerDlg.cpp b/SourceCode/Bond/Servo/CRobotCmdContainerDlg.cpp
index 9a9601a..14e2748 100644
--- a/SourceCode/Bond/Servo/CRobotCmdContainerDlg.cpp
+++ b/SourceCode/Bond/Servo/CRobotCmdContainerDlg.cpp
@@ -93,8 +93,13 @@
         m_pageRobotCmd[i].Create(IDD_PAGE_ROBOT_CMD, this);
         m_pageRobotCmd[i].MoveWindow(rcShrinked);
         m_pageRobotCmd[i].ShowWindow(SW_SHOW);
-        m_pageRobotCmd[i].EnableWindow(FALSE);
 		m_pageRobotCmd[i].SetSequenceNo(i + 1);
+        m_pageRobotCmd[i].SetControlsEnabled(i == 0);
+
+        if (i == 0) {
+            m_chkEnable[0].SetCheck(BST_CHECKED);
+            m_chkEnable[0].EnableWindow(FALSE);
+        }
     }
 
     // 璁$畻鏁翠綋瀹介珮
@@ -144,6 +149,24 @@
 
 void CRobotCmdContainerDlg::ToggleEnable(int index)
 {
+    constexpr int kMaxCount = 4;
+    if (index < 0 || index >= kMaxCount) {
+        return;
+    }
+
     BOOL bChecked = m_chkEnable[index].GetCheck();
-    m_pageRobotCmd[index].EnableWindow(bChecked);
+    m_pageRobotCmd[index].SetControlsEnabled(bChecked);
+
+    if (bChecked) {
+        for (int i = 1; i < index; ++i) {
+            m_chkEnable[i].SetCheck(BST_CHECKED);
+            m_pageRobotCmd[i].SetControlsEnabled(TRUE);
+        }
+    }
+    else {
+        for (int i = index; i < kMaxCount; ++i) {
+            m_chkEnable[i].SetCheck(BST_UNCHECKED);
+            m_pageRobotCmd[i].SetControlsEnabled(FALSE);
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3