Path of a Component In A Container

Hello. I recently put about 20 check boxes into a container. I am hoping to then read those check boxes to update a power table. However, I can not figure out what the path of the check box is to obtain the value. I am doing this in the script, so the code to get the attribute is quite lengthy. The att.chkBoxAtt value is the name of the check box.

system.gui.getWindow("Main Windows/DataView").rootContainer.getComponent("Container/" + att.chkBoxAtt).selected:
1 Like

Use two separate .getComponent() calls, one for the container and one for the checkbox. .getComponent doesn’t take a path, just a name. Consider saving the container object in a local variable and using it for all of the checkboxes.

1 Like

Thank you!

You could also do the following

system.gui.getWindow("Main Windows/DataView").getComponentForPath("Root Container.Container." + att.chkBoxAtt).selected:

Hello Pturmel. Your answer was very usefull for me. With reference to your last comment, can you explain a little bit more about saving the container object in a local variable?

Thank you very much. Regards.

@pturmel is suggesting something like this so you don’t have to repeat all the code to access the container for each item:

# Get container that holds the other components.
container = system.gui.getWindow("Main Windows/DataView").rootContainer.getComponent("Container")
# Access components in container.
container.getComponent("Text Field").text
# etc.
1 Like