Move a group based on a boolean

I am trying to get the hang of ignition and am looking for a way to move a group of components based on a Boolean tag. So if the tag is true I want the component to move in the Y say -35 but if a toggle the bit of a want it to move back to where it was.

The reason I want to do this is I have 8 indicators lined up in a column for all the possible options they can buy but, based on check boxes on a config screen, I want to display only the options that they did buy. So my plan is to tie the visibility to those check boxes and have the remaining indicator shift up.

I have attached a picture of what I have now.


Hello,

You could use a propertyChange event script and the system.gui.moveComponent(component, x, y) function to move the components. Probably easier to put the group of components in a container and then just move the container instead of the individual components.

Bind the boolean tag to a component property. For example create a custom property on the root container and then bind the boolean tag to it. Then write a propertyChange event script on the root container that runs when the property that you created changes. Make the script use the moveComponent function to move the container of components.

Here is a video that shows an example of writing a propertyChange event script: inductiveuniversity.com/video/event-object

Best,

If I am following you correctly, that would require writing a script that accounts for all possible combinations of options. Is there a way to write if so that it shift up till its within say 5 pixels of and object above it?

You could use the template repeater and just update the template repeater’s dataset.

Here’s my take on it:
InstalledOptionDisplay_2015-05-18_0717.proj (16.7 KB)

The options are stored in some form of dataset. The included table a custom dataset attached to it that has only the active options.

The checkbox has a custom property called trigger. Whenever a change to the table or the checkbox selection occurs. it sets this trigger. The trigger property change is where the magic happens.

If the checkbox is selected, it will grab all the options from the table. Then poplaute the text labels and rectangle colors accordingly. If the checkbox is unselected it will populate until it runs out of active options, and turn off the visibility on the rest.

As an extra feature, I set the container size to match however many are showing. No extra charge. :wink:
The layout constraints of the option groups are set to anchored so that they stay the same size when the container is resized.

On the rectangles, I gave a custom property called State. State is used in the style customizer to set colors.

I think that’s it in a nutshell.




Thank you veryuch! I think this will do what I want perfectly!