Page 1 of 1
the max scroll of a fld
Posted: Sat May 22, 2010 4:26 pm
by jmburnod
Hi All,
I need the max scroll of a fld.
This script work on my mac but there is maybe a more elegant and safe way
Code: Select all
function MaxScroll pFld
set the scroll of fld pFld to 100000
return the scroll of fld pFld
end MaxScroll
Regards
Jean-Marc
Re: the max scroll of a fld
Posted: Sun May 23, 2010 8:26 pm
by dunbarx
Hi.
Do you mean you need something like:
get the number of lines of fld "myField" * the textheight of fld "myField"?
or:
get the number of lines of fld "myField" * the textSize of fld "myField"?
Craig Newman
Re: the max scroll of a fld
Posted: Sun May 23, 2010 8:46 pm
by FourthWorld
If the field's fixedLineHeight is false you may want to use the formattedHeight of the field, which will account for any variances in the textHeight of lines within the field.
That assumes the goal is to obtain a number to be used for other purposes; if the goal is just to make sure the field is scrolled to show the bottom-most line of text you can use some unusually large number for the scroll and it'll stop at the bottom of the available text:
set the scroll of fld "MyField" to 999999
Re: the max scroll of a fld
Posted: Sun May 23, 2010 11:24 pm
by jmburnod
Hi Craig and Richard
Thanks for reply
Craig. I can't use the num of lines because the field is not a fld list and is wrapped
Richard. You're right
Damned ! I forgot the formattedheight function
Best
Jean-Marc
Re: the max scroll of a fld
Posted: Mon May 24, 2010 12:31 pm
by jmburnod
Hi,
Code: Select all
function MaxScroll pFld
set the scroll of fld pFld to 100000
put (the scroll of fld pFld) into theMaxS
return theMaxS
end MaxScroll
return 3058
Code: Select all
function MaxScrollbyFH pFld
put the num of chars of fld pFld into nb
put the formattedHeight of char 1 to nb of fld pFld into pF
return pf
end MaxScrollbyFH
return 3600
Re: the max scroll of a fld
Posted: Mon May 24, 2010 1:17 pm
by FourthWorld
jmburnod wrote:Damned ! I forgot the formattedheight function
That's why C has only 27 keywords: it makes it easy to learn.
