I have a need to iterate through all of the components on a screen and grab certain properties from those components from a script. I have a function that works to get all of the components on the screen and return a list of those component objects. The issue that I run into is that this list includes only those components that are in the root container of the window. Any containers I have on the window will be returned as normal components in the componentList.
Is there any way to check to see if a component is a container? I’d like to recursively iterate through all of my containers and add any components within them to the componentList. Here’s the code snippet I’m using so far.
#-------------------------------------------------------------------------
# Grabs all components within the root container of a window
#-------------------------------------------------------------------------
def getComponentsOnWindow(displayPath):
# Empty component list
componentList = []
window = system.gui.getWindow(displayPath)
container = window.getRootContainer()
# Create a list of all of the component names
for component in container.components:
componentList.append(component)
return componentList