How to Disable Prospective Components via Binding?

I’m using a flex container to display rows of binary statuses from instances of a particular UDT. Not all of these instances have every binary status, so I’d like to hide the label and indicator when the tag is disabled. Each of these label-indicator pairs are in a coordinate container (to keep things aligned visually) and these coordinate containers are in a flex root container. Right now, I have the basis of each container bound to an expression that checks whether the tag in question is disabled or not. If it is, set the basis to 0px. This completely hides the components, but there is still a gap of white space where the component would exist.

Does anyone know of a way to completely disable or remove components via a binding like this? I’m trying to eliminate that white space left over by setting the basis to 0px.

Hi.

You mean the containers that are not disabled are not growing to fill the gap of the disabled container? There is a visible property on every component as well. Maybe you could use that? Feel free to post some sort of screen shot to help illustrate what you’re trying to do.

Thanks!

In this screenshot, you can see that there is a gap between the top 5 indicators and the bottom 4. The red arrow is pointing to the gap. There is a coordinate container there containing another label and indicator pair. It has a 0px basis since the tag in question is disabled. Binding the visible property in a similar manner leaves a gap the same size as the container which is much larger than the 0px basis gap.

So, it’s hiding the way I would hope for. I’m just trying to remove that gap to make things look cleaner.

Screenshot: 2020-10-13 16_04_54-Window

Flex children should have a display attribute in component meta that can be set to false to (internally) set them to display: none, which makes them skip layout completely. Use that over visible if that’s what you actually need to do.

1 Like

Thank you! I somehow completely missed that attribute when browsing the user manual.

1 Like