【发布时间】:2023-03-04 05:25:01
【问题描述】:
使用 IntraWeb 14.1 和 Delphi Berlin,
我正在像这样在IWRegion 内创建一个框架并将其作为父级:
Page := TFrame.Create(Self);
Page.Parent := UserSession.Body_Region;
其中UserSession.Body_Region; 在UserSessionUnit 中被取消清除为Body_Region: TIWRegion;,以便在运行时将该区域从一个表单传递到另一个表单,并且一切正常。
问题是我想隐藏在运行时加载在UserSession.Body_Region 中的框架,即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;
但它不起作用!也没有错误!
有没有其他方法可以做到这一点,或者我在这里错过了什么?
【问题讨论】:
-
我用 {Visible} 试过,但我试过 {Enable} 来检查这段代码是否响应并错误地过去了,所以在这两种情况下 {Visible/Enable}它不工作。
-
也许设置
property RenderInvisibleControls: Boolean;(TIWRegion)False会有所帮助?见docs -
你说得对,我已将属性
RenderInvisibleControls设置为 false 并且代码开始像魅力一样工作 -
我认为这对其他用户也有好处,所以我对此做出了正确的回答。