the line number of the top line in a text field

James Hale james at thehales.id.au
Mon Jul 2 04:02:01 EDT 2012


Thanks Mike.

You suggestion to use the "screenmouseloc" works a treat in a static context i.e. after the field has been scrolled. 
It never occurred to me that I could use a virtual mouse position to provide the information I requred.

So while this provides an avenue for part 1 of the puzzle
However the context I want to use this is dynamic or at least pseudo dynamic.

Thinking out loud it would seem that to use this method I need to:
1. check the vscroll of the field while the mouse is inside the field (to cover scrollbar use as well as scroll wheel or drag gesture usage.)
2. if it changes, wait a while (enough to suggest the user has finished scrolling) and then check again.
3. once there has been no change, take a punt and assume the user has finished scrolling 
   or 
 if the mouse has left the field (scrolling definitely completed.)

implement  Mike's suggested method and get the line at the top of the field.

so as not to tie up the interface responsiveness I will probably need to set all this up using a message machine as described in Dar Scott's excellent primer.

Of course if anyone has already done this I would be grateful for some sample code :-)

James



More information about the use-livecode mailing list