calculating max vscroll

Dave Cragg dcragg at lacscentre.co.uk
Fri May 20 15:50:58 EDT 2005


On 20 May 2005, at 20:19, Chris Sheffield wrote:

> Does anyone have a function that will calculate the maximum amount  
> a field can scroll if its height is too small to display it's  
> entire contents at once?  (did that make sense; it's been a long  
> day and I have a headache :-))
>
> Problem is I have a couple fields that I'm scrolling together, and  
> for some reason one is scrolling slightly more than the other,  
> which makes things slightly misaligned.  The main field contains  
> regular text (this is the one that scrolls slightly more for some  
> reason), and the other field contains bullets that should line up  
> with the text in the main field (much like the breakpoint list  
> toggle column in the Rev script editor).  I thought if I could  
> calculate the maximum vscroll, I should be able to limit them so  
> they stay together exactly.  But unfortunately I'm having a hard  
> time figuring out how to do that.  Both fields are set to use the  
> same font and size and have the same textHeight value.


As Jonathon pointed out,  you the maximum scroll can be calculated  
with this:

   (The formattedheight of field "myField1") - (the height of field  
"myfield1")

But you also need to be sure that both fields have the same number of  
lines, and that lines don't wrap in either field. Depending on what  
you're doing, you may need to pad one field with blank lines.

Dave




More information about the use-livecode mailing list