# List of controls within a container

**URL:** <https://forum.inductiveautomation.com/t/list-of-controls-within-a-container/3667>\
**Category:** Ignition\
**Created:** [November 29, 2011, 3:42pm UTC](https://forum.inductiveautomation.com/t/list-of-controls-within-a-container/3667 "2011-11-29T15:42:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [November 29, 2011, 3:42pm UTC](https://forum.inductiveautomation.com/t/list-of-controls-within-a-container/3667/1 "2011-11-29T15:42:45Z")

</div>

Hello,

I want to write a general purpose function to enable or disable each control inside a container,

something like this:

```auto
panel=event.source.parent.getComponent('someContainer')
for ctl in panel.controls:
   print ctl.name
   ctl.enabled=1
```

But I dont know if there is a property that has a list of all the controls.  
Is there a way to do this?

Thank you.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [November 29, 2011, 4:12pm UTC](https://forum.inductiveautomation.com/t/list-of-controls-within-a-container/3667/2 "2011-11-29T16:12:21Z")

</div>

Yes, you can do the following:`cont = event.source.parent.getComponent("someContainer")
for comp in cont.getComponents():
    print comp.name
    comp.enabled = 1`

---

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [November 29, 2011, 4:27pm UTC](https://forum.inductiveautomation.com/t/list-of-controls-within-a-container/3667/3 "2011-11-29T16:27:40Z")

</div>

Thank you very much Travis!

This is great!

---

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [November 29, 2011, 11:25pm UTC](https://forum.inductiveautomation.com/t/list-of-controls-within-a-container/3667/4 "2011-11-29T23:25:20Z")

</div>

Hello Travis,

Taking this code one step ahead… is there a way to determine what type of component is in the cycle?  
For instance, let’s say I only want to disable the text fields but not the numeric fields.

Something like:

```auto
cont = event.source.parent.getComponent("someContainer")
for comp in cont.getComponents():
    print comp.name
    if comp.type=="textField":
          comp.enabled = 0
```

Thank you

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [November 29, 2011, 11:35pm UTC](https://forum.inductiveautomation.com/t/list-of-controls-within-a-container/3667/5 "2011-11-29T23:35:27Z")

</div>

Yes, but the type is kind of hidden to you:`cont = event.source.parent.getComponent("someContainer")
for comp in cont.getComponents():
    print comp.name
    if str(comp.getClass()).endswith("PMINumericTextField"):
          comp.enabled = 0`Now to get the actual type you can copy the component from the designer and paste it into a text editor. There you will see the type like PMINumericTextField.

---

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [November 30, 2011, 2:01am UTC](https://forum.inductiveautomation.com/t/list-of-controls-within-a-container/3667/6 "2011-11-30T02:01:14Z")

</div>

Thank you very much Travis!
