加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

delphi – 如何在运行时隐藏组件?

发布时间:2020-12-15 09:23:31 所属栏目:大数据 来源:网络整理
导读:使用IntraWeb 14.1和Delphi Berlin, 我正在IWRegion中创建一个框架,并在其中创建框架,如下所示: Page := TFrame.Create(Self); Page.Parent := UserSession.Body_Region; UserSession.Body_Region;被取消为Body_Region:TIWRegion;在UserSessionUnit中,在运
使用IntraWeb 14.1和Delphi Berlin,
我正在IWRegion中创建一个框架,并在其中创建框架,如下所示:

Page := TFrame.Create(Self);
 Page.Parent := UserSession.Body_Region;

UserSession.Body_Region;被取消为Body_Region:TIWRegion;在UserSessionUnit中,在运行时将该区域从表单传递给表单,并且一切正常.

问题是我想在运行时隐藏UserSession.Body_Region中加载的Frame,即UserSession.Main_Body_Region.Component [0];但我不能这样做.

我尝过了

(UserSession.Main_Body_Region.Component[0] as TFrame).hide;

要么

(UserSession.Main_Body_Region.Component[0] as TFrame).Visible:= false;

但它不起作用!也没有错误!

有没有其他方法这样做或我错过了什么?

解决方法

虽然 documentation说的

TIWRegion control is the IntraWeb equivalent of the TPanel from VCL.

它有一个重要的区别,需要考虑:

属性RenderInvisibleControls:Boolean;继承自TIWBaseContainer

文档将其描述为

Use this property to inform that any control that has Visible = False
when the container it is rendered will also be rendered along with the
visible controls. This is particulary useful when you need to change
the visibility of controls using Async events.

IOW,将此属性设置为False将停止呈现Visible = False的子组件.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读