Find the scroll location in wrapped field

dunbarx at aol.com dunbarx at aol.com
Tue Nov 18 09:10:17 EST 2014


James.


The field will scroll to the desired line, but if the textSizes of those lines are variable, the scroll will not come out right.


The discussion here and on the forum is how to make that happen. So far, no solution. The OP wanted to find text, and this is straightforward, in that the foundline can be used to set the line selection. But his data was with mixed textSizes, and that is how this all started.


Craig Newman



-----Original Message-----
From: James Hale <james at thehales.id.au>
To: use-livecode <use-livecode at lists.runrev.com>
Sent: Tue, Nov 18, 2014 12:19 am
Subject: Re: Find the scroll location in wrapped field



As per the forum discussion, if you want the desired text to scroll to the top 
of the field you simply need to scroll first to the bottom of the field. 
Selecting line x of a field instructs the engine to scroll the field contents 
until line x is visible. As the engine stops as soon as the desired position is 
visible in the field, starting the field at its bottom scroll means that the 
sought line can only appear at the top of the field (unless of course it is 
already visible.) it matters not whether the text height is fixed or variable. 
The engine knows when a line becomes visible regardless of whatever text heights 
are involved.
So if you have the linenumber of the line contains the text you wish to see at 
the top of the field then...

   select line  -1 of  field "TextToScroll"
   select line linenumber of  field "TextToScroll" 

And line linenumber will now be at the top of the field.

James


_______________________________________________
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