align field scrolls

Paul Hibbert paul at
Sun Mar 5 21:26:06 EST 2017

I have a stack that does a similar thing, but with numbers and I just use the following script in the main field;

on scrollBarDrag pScroll
   set the vScroll of fld  “lineNumbers" to pScroll

end scrollBarDrag

Provided both fields have the same number of lines and the text properties are identical they should stay aligned correctly.

Or a simpler version would be;
set the vScroll of fld 2 to the vScroll of fld 1


> On Mar 5, 2017, at 6:00 PM, Nicolas Cueto via use-livecode <use-livecode at> wrote:
> Hi.
> The part I've got working...
> Two clickable scrolling fields (fld1, fld2), same height and width. Click a
> fld1 line and fld2 SCROLLs and HILITEDLINEs to visually reveal a matching
> line. (fld1 is French text, fld2 is an English gloss.)
> The part I would welcome your help with...
> If, say, the hilited line on fld1 is kinda halfway down, how do I get the
> hilited line on fld2 to also be kinda halfway down?
> Here's my scrolling-magic script:
>  set the scroll of fld2 to (tMatchingLineNr - 1) * \
>    the textHeight of fld2 - the textHeight of fld2
>  set the hilitedline of fld2 to tMatchingLineNr
> Of course, this ends up with the hilited line of fld2 being at the top.
> How do I get it to scroll just that little bit more so that it aligns with
> the hilited line as seen in fld1?
> Thank you.
> --
> Nicolas Cueto
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the use-livecode mailing list