# What am I missing?

**URL:** <https://forum.inductiveautomation.com/t/what-am-i-missing/5987>\
**Category:** Ignition\
**Created:** [March 7, 2013, 10:37pm UTC](https://forum.inductiveautomation.com/t/what-am-i-missing/5987 "2013-03-07T22:37:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [March 7, 2013, 10:37pm UTC](https://forum.inductiveautomation.com/t/what-am-i-missing/5987/1 "2013-03-07T22:37:38Z")

</div>

Why does this code:[code]  
#populute the navigation buttons  
#get the list of windows  
windows = system.gui.getWindowNames()  
button = 1

#we only have 20 buttons  
for path in windows:  
if button \< 20 and path[:8] == ‘Onelines’: #compare the first 8 chars only  
selector = system.gui.getParentWindow(event).getComponent(“Button 1”)  
def updateButton(selector, path):  
selector.ButtonLabel = path[9:] #strip ‘Onelines:’  
selector.WindowName = path  
selector.visable = 1  
system.gui.invokeLater(selector, path)  
button += 1  
[/code]produce this error[code]  
Traceback (most recent call last):

File “event:internalFrameOpened”, line 9, in

TypeError: getComponent(): 1st arg can’t be coerced to int

Ignition v7.5.6 (b1317)  
Java: Oracle Corporation 1.7.0\_15  
[/code]

---

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [March 7, 2013, 10:47pm UTC](https://forum.inductiveautomation.com/t/what-am-i-missing/5987/2 "2013-03-07T22:47:48Z")

</div>

is the function you are looking for in the util group. also i think you have to send the name of the function and you have to set defaults for the parameters because they cannot be passed in the call with invokeLater.

[code]#populute the navigation buttons  
#get the list of windows  
windows = system.gui.getWindowNames()  
button = 1

#we only have 20 buttons  
for path in windows:  
if button \< 20 and path[:8] == ‘Onelines’: #compare the first 8 chars only  
selector = system.gui.getParentWindow(event).getComponent(“Button 1”)  
def updateButton(selector=selector, path=path):  
selector.ButtonLabel = path[9:] #strip ‘Onelines:’  
selector.WindowName = path  
selector.visable = 1  
system.util.invokeLater(updateButton)  
button += 1[/code]

---

<div class="post-metadata">

**Author:** ![James.Lorenz](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/james.lorenz/32/3290_2.png) [@James.Lorenz](https://forum.inductiveautomation.com/u/James.Lorenz)\
**Post date:** [March 7, 2013, 10:59pm UTC](https://forum.inductiveautomation.com/t/what-am-i-missing/5987/3 "2013-03-07T22:59:13Z")

</div>

Jonathan’s revisions are correct, and also you need to revise line 9 to include a rootContainer property reference:

```auto
selector = system.gui.getParentWindow(event).rootContainer.getComponent("Button 1")
```

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [March 8, 2013, 12:21am UTC](https://forum.inductiveautomation.com/t/what-am-i-missing/5987/4 "2013-03-08T00:21:35Z")

</div>

Thanks James,

The root container thing was the missing key.

And thank you Jonathan for solving my next problem before I even get to it. ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:")
