# Highlighting multiple lines in a list

**URL:** <https://forum.inductiveautomation.com/t/highlighting-multiple-lines-in-a-list/1994>\
**Category:** Ignition\
**Created:** [June 30, 2010, 4:09pm UTC](https://forum.inductiveautomation.com/t/highlighting-multiple-lines-in-a-list/1994 "2010-06-30T16:09:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [June 30, 2010, 4:09pm UTC](https://forum.inductiveautomation.com/t/highlighting-multiple-lines-in-a-list/1994/1 "2010-06-30T16:09:43Z")

</div>

I’m trying to highlight multiple lines in a list when I open a window. The list has a binding to a SQL query.

In the window’s internalFrameActivated event I create a dataset from a database query, then I loop through all the lines in the list and use addSelectionInterval() to highlight the line if a match is found.

However, I am getting inconsistent results - testing seems to show that the length of the list is varying during the course of the script. When does the list get populated? Is it before, during or after the internalFrameActivated script is run?

---

<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:** [June 30, 2010, 5:56pm UTC](https://forum.inductiveautomation.com/t/highlighting-multiple-lines-in-a-list/1994/2 "2010-06-30T17:56:29Z")

</div>

You don’t know, it could be before or after. So what you need to do is wrap the selection up into an invokeLater which will happen after all of the bindings take place.

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [June 30, 2010, 8:27pm UTC](https://forum.inductiveautomation.com/t/highlighting-multiple-lines-in-a-list/1994/3 "2010-06-30T20:27:57Z")

</div>

Thanks Travis, that worked perfectly.
