From 1a69cd1110f9f9fa34a639e5c8efc7165a34126e Mon Sep 17 00:00:00 2001 From: LanHeron Date: Mon, 8 Sep 2025 11:39:18 +0800 Subject: [PATCH] vault backup: 2025-09-08 11:39:18 --- .../相关操作/4.0-other/999.Delphi脚本记录.md | 38 ++----------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/SanPinPLM/相关操作/4.0-other/999.Delphi脚本记录.md b/SanPinPLM/相关操作/4.0-other/999.Delphi脚本记录.md index 6bb7d21d..13ad1f99 100644 --- a/SanPinPLM/相关操作/4.0-other/999.Delphi脚本记录.md +++ b/SanPinPLM/相关操作/4.0-other/999.Delphi脚本记录.md @@ -879,43 +879,18 @@ end. ## 控制窗体表单明细表是否显示 -和上一段对比,因为没有使用 `Sender` 参数,所以这个段脚本可以使用在 **事件脚本** 上 +和上一段对比,因为没有使用 `Sender` 参数,所以这个段脚本可以使用在 **事件脚本** 上,同时==不建议采用单选组合框== ```delphi uses MyClass, Variables, BaseUtil, CommonFunc, DataConst, CFFrm, CFSimplePropFrm, Forms, StdCtrls, Variants, SysUtils, Classes, Controls, Dialogs, CHostIntf, ProductClas, DocClas, LoginClas, VirtualTrees, CEntClas, PathClas, cxRadioGroup; -var - rdgrpmuf_9: TcxRadioGroup; // 声明单选框组变量 - i: Integer; - begin - try - // 尝试查找并初始化单选框组组件 - // 这里假设rdgrpmuf_9是窗体上的一个组件,需要确保它已被正确创建和初始化 - if not Assigned(rdgrpmuf_9) then - begin - // 如果组件未分配,尝试从屏幕上的窗体中查找 - for i := 0 to Screen.FormCount - 1 do - begin - if Screen.Forms[i].FindComponent('rdgrpmuf_9') is TcxRadioGroup then - begin - rdgrpmuf_9 := TcxRadioGroup(Screen.Forms[i].FindComponent('rdgrpmuf_9')); - Break; - end; - end; - - // 如果仍然找不到组件,显示错误信息并退出 - if not Assigned(rdgrpmuf_9) then - begin - ShowMessage('找不到rdgrpmuf_9组件'); - Exit; - end; - end; + // 根据选择的值显示对应的控件 - case rdgrpmuf_9.ItemIndex of + case fedtmuf_9.ItemIndex of 0: // 选中第一项 begin gbcxtsCusPage_1.Visible := True; // 显示页面1 @@ -986,13 +961,6 @@ begin gbcxtsCusPage_6.Visible := False; gbcxtsCusPage_7.Visible := True; end; - end; - except - on E: Exception do - begin - // 显示具体的异常信息 - ShowMessage('发生错误: ' + E.Message); - end; end; end. ```