Programmatically iterate through all the controls located in a window

I am looking for some pointers/code snippets to use to retrieve the following information through scripting:

  • list of all the controls located in a window
  • determine the type of control; example: text box, label, template etc
  • if the control is template, determine the template type and path
  • retrieve value of one of the properties of a template
    i would like to run this code snipped in the visionwindow opened event.

Start with something like this:

r = event.source.rootContainer for comp in r.components: print comp.name, comp.getClass()
Watch the debug console to see what is going on. You’ll want to make this recursive to get everything in groups and containers, and with known types, you can selectively access all the normal properties of these components.

2 Likes