The formatted mouseline?

David Bovill david at openpartnership.net
Thu Jan 12 12:24:48 EST 2006


On 12 Jan 2006, at 18:20, Dave Cragg wrote:

>
> On 12 Jan 2006, at 16:16, Mark Swindell wrote:
>
>
>> I'm looking for the location of the formatted line, or its  
>> coordinates relative the field, so that I can place a graphic (an  
>> underline or somesuch) under the text of that formatted line.   
>> This has to be derived from the mouse position relative to the  
>> formatted line position as this graphic will move based on where  
>> the mouse is.
>>
>
> Not perfect, but something like this in the field script (graphic 1  
> is the graphic to be moved):
>
> on mouseMove
>   put the mouseChunk into tMC
>   if tMC <> empty then
>     get the formattedRect of tMC
>     set the top of graphic 1 to item 4 of it
>   end if
> end mouseMove
>
> I'm assuming the graphic width would be set to the width of the field.
>
> One limitation is that when the mouse moves over empty space at the  
> end of a line, the mouseChunk returns empty. I can't think of a way  
> round that.

Perhaps with something like the following? Seem to remember it worked  
out :)

    1) Use the mouseline to get the line number you need

     2) Lock the screen

     3) Select the text of the field after the end of the line number

     4) Use the selectedLoc to figure out the position of the bottom  
of the wrapped line

     5) You can use a similar technique for the top or work it out  
using the textHeight and line number calculations.



More information about the use-livecode mailing list