如何观察子节点的可见性? [英] How to observe the visibility of a child node?

查看:80
本文介绍了如何观察子节点的可见性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当父节点变为不可见时,子节点也将变为不可见,而无需修改子节点的可见属性.那么,如何在不观察所有父节点和层次结构的情况下观察子节点的可见性?是否有适当的事件被触发?

When a parent node becomes invisible a child becomes invisible too without modifying child visible property. So how can the visibility of a child node be observed without observing all parent nodes and the hierarchy? Is there a proper event fired?

推荐答案

我认为没有直接的方法可以实现您想要的目标.父可见性更改时,没有要观察的属性,也不会触发任何事件.

I don't think there is a direct way to achieve what you want. There is no property to observe and no event is fired when the parent visibility changes.

您可以看一下Node.parentPropertyImpl()的内部实现,该实现基本上可以避免您想做的事情:它将InvalidationListener添加到父级的impl_treeVisibleProperty(内部API已弃用).

You can take a look at the internal implementation of Node.parentPropertyImpl(), which basically does what you want to avoid: it adds an InvalidationListener to the parent's impl_treeVisibleProperty (internal API and deprecated).

这篇关于如何观察子节点的可见性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆