Find the scroll location in wrapped field

dunbarx at aol.com dunbarx at aol.com
Tue Nov 18 17:11:04 EST 2014


Jacque.


Neither do I. Not sure anymore which handlers I have tried and which not.


And your methodology is so compact and elegant.


Craig






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





-----Original Message-----
From: J. Landman Gay <jacque at hyperactivesw.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Tue, Nov 18, 2014 2:38 pm
Subject: Re: Find the scroll location in wrapped field


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

_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list