# Update component on window focus

**URL:** <https://forum.inductiveautomation.com/t/update-component-on-window-focus/39513>\
**Category:** Ignition\
**Created:** [October 8, 2020, 7:53pm UTC](https://forum.inductiveautomation.com/t/update-component-on-window-focus/39513 "2020-10-08T19:53:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![steven.cox](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steven.cox/32/18589_2.png) [@steven.cox](https://forum.inductiveautomation.com/u/steven.cox)\
**Post date:** [October 8, 2020, 7:53pm UTC](https://forum.inductiveautomation.com/t/update-component-on-window-focus/39513/1 "2020-10-08T19:53:30Z")

</div>

Hi all,

Another newbie question. I am hoping the answer will basically apply to all (most/some) components.

I have a drop down that is bound a select query (not a named query). I want the query to update each time the window comes into focus.

Is there a function that I can run in the event handler to update a component.

Example:

Dropdown is on main window.  
Open a popup that adds to the database table the dropdown looks at.  
when I close the popup (bring main window in focus) the new data is not in the dropdown.

If I close the main window and reopen, it is fine.

Thanks, Steven

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [October 8, 2020, 7:56pm UTC](https://forum.inductiveautomation.com/t/update-component-on-window-focus/39513/2 "2020-10-08T19:56:54Z")

</div>

Have a look at the Windows Scripting event handlers (and in your case the internalFrameActivated event).  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/a/6a427469d9b2951f7797a4030081804aba822db2.png)

---

<div class="post-metadata">

**Author:** ![steven.cox](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steven.cox/32/18589_2.png) [@steven.cox](https://forum.inductiveautomation.com/u/steven.cox)\
**Post date:** [October 8, 2020, 8:02pm UTC](https://forum.inductiveautomation.com/t/update-component-on-window-focus/39513/3 "2020-10-08T20:02:45Z")

</div>

@code_skin, that is what I want to do, but what function updates the component?

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [October 8, 2020, 8:04pm UTC](https://forum.inductiveautomation.com/t/update-component-on-window-focus/39513/4 "2020-10-08T20:04:32Z")

</div>

It would be something like

```auto
component = rootContainer.getComponent('Dropdown')
system.db.refresh(component, 'data')

```

---

<div class="post-metadata">

**Author:** ![steven.cox](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steven.cox/32/18589_2.png) [@steven.cox](https://forum.inductiveautomation.com/u/steven.cox)\
**Post date:** [October 8, 2020, 8:08pm UTC](https://forum.inductiveautomation.com/t/update-component-on-window-focus/39513/5 "2020-10-08T20:08:21Z")

</div>

@code_skin,

That’s what I was looking for. I wasn’t expecting it to be in the system.db functions.

Thanks so much!!

Steven
