Text List/Matrix Autoscroll

Has anyone figured out how to get Text List & Matrix objects to autoscroll to the selected line/cell when the value of the selection variable is changed procedurally? Performing a ‘showvariables’ statement does hilite the correct line/cell, but does not bring it into view if it’s outside of the object’s current scroll display.

(My question applies to situations where database navigator is not an applicable option, as autoscroll seems to work very nicely when database navigator can be used.)

If you are using a Textlist and have a search box, which by default uses a variable _liveSearch, I found if you change the value of _liveSearch programmatically, then use showvariables _liveSearch, the textlist updates to show show the search results for the new value. All of the records then displayed contain the value of _liveSearch.
But I wonder if you are asking a different question.

There is an undocumented commands based on the objectaction statement that I think might help you. This code will cause the 7th row of a text list to be visible. You’ll need to use something like arraysearch( to determine which row number you want.

objectaction "Text List Object Name","scrolltorow",7

The command name is different for a Matrix object.

objectaction "Matrix Object Name","autoscroll",7

These commands aren’t currently documented or supported, but I think they will work for you.

This is an example using a Text List named theList filled with a variable named theItems containing the listed items and using a variable named theSelection for the current selection:

objectaction "theList","scrolltorow",arraysearch(theItems, theSelection, 1, cr())

Works very reliably in my simple tests when selecting a new item procedurally and scrolling it into view.

Quick test confirms works as advertised for both object types! Very slick, and many thanks! One wonders what other mysteries lurk beneath the PanX surface!! :wink: