Scrolling to a line in a field

Devin Asay devin_asay at byu.edu
Mon Jan 12 10:19:56 EST 2009


On Jan 11, 2009, at 5:15 PM, David Bovill wrote:

> I have this old command - and just found that it is not accurate for  
> a field
> of text with large line numbers. Can anyone make it more accurate?
>
> on field_ScrollToLine lineNum, fieldObject
>    -- does not seem accurate for large line numbers (it's an  
> underestimate)
> ???
>
>    if lineNum = 0 then
>        put 0 into someScroll
>    else if lineNum is a number then
>        put the effective textheight of fieldObject into lineHeight
>        put ((lineNum - 1) * lineHeight) * the height of fieldObject  
> into
> someScroll
>    end if
>    set the scroll of fieldObject to someScroll
> end field_ScrollToLine
> _______________________________________________

David,

Could it be that the fixedLineHeight is off? That would mess up a  
handler like this if there were varying sizes of text in the field.

As an alternative, I have simply used 'select line lineNum' in list  
fields and the engine will automatically scroll to that line.

Regards,

Devin


Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list