Find the scroll location in wrapped field

J. Landman Gay jacque at hyperactivesw.com
Tue Nov 18 14:37:10 EST 2014


On 11/18/2014, 1:08 PM, dunbarx at aol.com wrote:
> I tried a bunch of stuff like that; your thinking seems sound. I
> thought mine did as well.  Sometimes it sets a line properly, and
> sometimes, especially  with small textSize lines near large ones, not
> at all. In fact, several lines away.


I am still not having any issues at all with this handler:

on doScroll pNum
   put the formattedheight of line 1 to pNum of fld 1 into tScroll
   set the scroll of fld 1 to tScroll
   set the hilitedline of fld 1 to pNum
end doScroll

It places the correct line at the top, no matter which line is currently 
selected, and selects the designated line of the field.

The thing that makes this work is that it does require having 
listbehavior set to true. Once that's done, the engine handles all the 
details without any trouble.

Here is the handler I used to set up the field content. I add the line 
numbers so I can see whether the correct line does in fact get selected.

on setup
   get the colornames
   repeat with x = 1 to the number of lines in it
     put x & space before line x of it
   end repeat
   put it into fld 1
   repeat with x = 1 to the number of lines in fld 1 step 2
     set the textsize of line x of fld 1 to random(40)+12
   end repeat
end setup


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list