vault backup: 2025-09-08 11:39:18
This commit is contained in:
@ -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.
|
||||
```
|
||||
|
Reference in New Issue
Block a user