飞镖 /颤音:如何访问窗口小部件的成员变量 /值
我有一个小部件列表。小部件是网站的背景图像。此列表中的最后一个小部件(图像)在屏幕上显示。当导航函数推送/pop时,最后一个元素将被删除/添加。
小部件中的一个字段(背景图)是一个名为“ Isforeground”的布尔。我需要访问它。
为什么?一些背景图像是前景,应在该网站的半透明背景纹理上方渲染,其中一些要在其后面呈现。
如果我有一个列表(背景图),而背景图则包含: 路径,BoxFit,不透明度,Isforeground(bool)等。如何在背景图列表中访问最后的背景图并访问其ISForground字段?
// psudo小部件树:
if(backdropimagelist.last的“ isforground”字段是错误的)背景图。 BackicktTextureWidget, if(Backdropimagelist.last's Isforground字段是真实的)背景图。last//在纹理上方渲染 headingwidget, 除了可能的话
(或替代方法),我会感谢您的帮助。替代性是每次按下/弹出按钮时,以编程为单位,并跟踪显示哪些图像的位置。首先知道哪些图像是前台/背景,并且从对象本身控制哪些图像是更整洁的IMO。 谢谢伙计们。
I have an list of widgets. The widgets are background images for a website. The last widget(image) in this list is displayed onscreen. As nav functions push/pop, the last element is removed/added.
One of the fields in the Widget(BackdropImage) is a bool called 'isForeground'. I need access to it.
Why? Some background images are foreground and are to be rendered above the site's semi-transparent background texture, some are to be rendered behind it.
If I have a List(BackDropImage) and the BackDropImage contains:
Path, BoxFit, Opacity, isForeground(bool) etc etc. How can I get access to the last BackDropImage in BackDropImage list and access its isForground field?
//PSUDO WIDGET TREE:
if(backdropImageList.last's 'isForground' field is FALSE) BackDropImage.last,//render here below the texture
BackgroundTextureWidget,
if(backdropImageList.last's isForground field is TRUE) BackDropImage.last //render here above the texture
HeadingWidget,
OtherWidgets
I'd appreciate help if possible (or alternative approaches). The alterative is to flip a bool programmatically every time a button is pressed/popped and keeping track of what images are displayed where. Knowing which images are fore/background in the first place and controlling from the object itself is much neater IMO.
Thanks folks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
小部件是一个抽象类。当使用具有成员变量的容器等小部件时,您需要以编程方式访问会员,可以这样做:
要访问小部件列表中的单个小部件的成员变量:
另外,您也可以执行类似的事情:
Widget is an abstract class. When working with Widgets like Container etc that have member variables you need to access programmatically, it can be done like this:
To access the member variables of individual Widgets in a list of Widgets:
Alternatively, you can also do things like this: