How to set scroll position for list boxesI am getting Object 'ListBoxBox' does not recognize the message 'get scroll position' errors when trying to set the scroll location for a list box.
My script automatically selects a value from the list, but if that value is not currently visible, it looks like the list box has no selection. It would be good for me if I could get it to scroll down to make sure the user doesn't get confused by this. I've been looking at the Set Scroll Position documentation.
Does anyone know how to do this? Thanks!
Names Default To Here( 1 );
listOfItems = {};
for (i = 1, i <= 30, i++,
insert into(listOfItems,"Item " || char(i));
);
New Window( "Example",
fontobj = lb = List Box(
listOfItems,
width( 200 ),
max selected( 2 ),
nlines( 6 )
)
);
lb << set selected(7);<BR /><BR />//lb << somehow scroll down to make position 7 visible!ScriptingRe: How to set scroll position for list boxesNeither the ListBox() or the ListBoxBox() objects accept scroll position messages. Those messages work with ScrollBox(); See the example below, and read about it in the Scripting Guide
win = New Window( "Example",
sb = Scroll Box(
Size( 150, 75 ),
List Box(
{"First Item", "Second Item",
"Third Item", "Fourth Item",
"Fifth Item"},
width( 200 ),
max selected( 2 ),
nlines( 6 )
)
)
);
win << Set Window Size( 300, 200 );
sb << Set Scrollers( 1, 1 ); // enable both scroll bars
sb << Set Scroll Position( 0, 10 ); /* position the scrollers on