On Aug 27, 2011, at 5:11 AM, Tim Selander wrote:

> I have a field full of (locked) text (a TV script), lines are wrapped. I want 
> to be able to click a word in the text and automatically set the scroll of 
> the field so that the line with the clicked word is at the very top of the 
> field.
> 
> I can set the vscroll of the field using the number returned by (the 
> clickline)*(the textheight) of the field. But, each wrapped line in the text 
> above the click throws that calculation off...
> 
> How can I take the wrapped lines into consideration so that the text my users 
> click pops to the top of the field?

Something like this, maybe (untested)

on mouseup
   put word 2 of of the clickCharChunk into chNbr
   put the number of words of char 1 to chNbr of me \
           into wordNbr
   put the formattedheight of word 1 to wordNbr of me \
           into upToHere
   put the textheight of me into txtHt
   set the scroll of me to upToHere - txtHt
   -- so the line remains visible
end mouseup

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig




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

Reply via email to