Scrolling flds
Ken Ray
kray at sonsothunder.com
Tue Apr 5 22:13:42 EDT 2005
On 4/5/05 3:31 PM, "Yves COPPE" <yvescoppe at skynet.be> wrote:
> Hi list,
>
> I have a fld with an alphabetical list
>
> I have a script to automatically scroll the fld at the beginning of a
> clicked letter : tKey
>
> (thank you Klaus)
>
> put lineOffset(return & tKey, fld "body") into lo
Be careful... when you look for "return & tKey", you need to look for it in
"return & fld "body"" otherwise you'll be one line off AND you will never
match the first line. For example, consider this list, which I'll call
tFruit (and I use "CR" instead of "return"):
apple<CR>
banana<CR>
grape<CR>
watermelon
If I ask for lineOffset(CR & "b",tFruit), I'll get "1" instead of "2"
because the first part of the match (the CR following "apple") is on line 1
instead of line 2.
Similarly, if I ask for lineOffset(CR & "a",tFruit), I will get 0 because
the list doesn't start with a CR; it starts with "a".
So to make it work properly, you need to do:
put lineOffset(CR & "b",CR & tFruit)
This causes my list to look like this:
<CR>
apple<CR>
banana<CR>
grape<CR>
watermelon
So matching CR & "b" matches the CR following "apple", which is on line 2.
Start there, and see if you still need to adjust your scrolling.
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode
mailing list