Scroll to a line in a field

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Preston Shea
Posts: 73
Joined: Sat Apr 08, 2006 6:51 pm

Scroll to a line in a field

Post by Preston Shea » Tue Nov 16, 2010 8:12 pm

How does one scroll down to a specific line in a field?
In nova fert animus mutatas dicere formas corpora.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Scroll to a line in a field

Post by Dixie » Tue Nov 16, 2010 9:01 pm

Preston...

If you want to scroll to line 20... in a scrolling list field...

Code: Select all

on mouseUp
   set the vScroll of fld 1 to (20 * the effective textHeight of fld 1)
   set the hilitedLine of fld 1 to 20
end mouseUp
be well

Dixie

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Scroll to a line in a field

Post by dunbarx » Tue Nov 16, 2010 10:54 pm

Dixie's script is just fine. He even hilites the target line.

Just note that the field does not have to be a scrolling field. Any field can be "scrolled", in the sense that lines below the visible extent of the field can be brought into view in the same manner.

Craig Newman

Post Reply