"hidden" objects added to scrollable panel (both fixWidthSizer and Sizer) reappear on scroll
I've added several rexUI bbcode text elements to a scrollable panel.
I hide one of the text elements using bbcodeText.setVisible(false). The text element within the scrollablePanel immediately hides in as expected.
When I scroll, the bbcodeText element reappears.
I've tried finding the element using on('scroll' then sifting through the panel's children, but cannot locate the text elements.
How can I prevent this unwanted behavior from happening?
- Set child game object to invisible :
parentSizer.setChildVisible(child, visible)ref. Parent does not know (does not check child's properties) if child is set to invisible. - Hide child and don't layout this child :
scene.rexUI.hide(child)ref. Invisible child will be layout with other children if not hide
@rexrainbow Hi, I've finally gotten back to this. If I use parentSizer.setChildVisible(child, false), or a workaround such as child.setAlpha(0), it hides, and keeps the child hidden even on scroll, but the children still take up space in the layout, even if I call "scrollablePanel.layout()` again.
Not hidden:
Hidden:
But the elements should collapse to what's visible. It seems that my only option is to destroy the elements and re-add them to the scrollablePanel when a user selects different categories that should show/hide options.
Please see my previous post.
Hide child and don't layout this child : scene.rexUI.hide(child) ref. Invisible child will be layout with other children if not hide