Selecting a Text List Row Programmatically

The help page on Text List programming explains how to scroll a text list to make sure a row is visible. But then it says

Note that this doesn’t mean that row 27 will be the topmost visible row – only that it will be visible somewhere within the visible area of the list. Also note that the “scrolltorow” action doesn’t select the row – it only scrolls the list to make sure the row is visible.

Is there a way to select programmatically the row so it becomes highlighted, i.e., without having to click the row?

If the Database Navigator option is enabled, then the row corresponding to the current database record will be highlighted.

I’m guessing that you are not using the Database Navigator option. In that case, the object is linked to a field or variable. To change what row is highlighted, change the value in the field or variable. If it is a variable, you’ll need to follow up with showvariables.

For example, suppose you have a list that shows colors, and is linked to a variable named selectedColor. You can change the highlighted row like this:

selectedColor = "Blue"
showvariables selectedColor

I’m assuming that the list contains an item named Blue, it won’t work if you put in a value that is not displayed in the list.

Thanks, that worked. I had everything up to showvariables.

Modifying a variable never affects the display unless you use showvariables. Updating the display is quite a slow operation, if Panorama attempted to update the display every time the value of a variable changed it would massively slow down any code that used variables.