> On Mar 4, 2016, at 1:08 PM, Mark Mitchell <cowh...@mac.com> wrote:
> 
> (Sorry Heather!  I’m sending this message again from the ‘proper’ account..)
> 
> I’m not sure how long it has been around, but I have just discovered the 
> ‘mousewhithin’ message combined with the mouseline() function… Awesome!  So, 
> for those of you who don’t know, the ‘mousewithin’ message is sent to a field 
> periodically (5 times a second?) whenever the mouse is inside that field. 
> 
> Then, the mouseline function returns whatever line of that field the mouse is 
> currently hovering over.  I am currently using this to warn folks if they 
> have too many characters per line.  And that works fine.
> 
> But to make it more intuitive, I want to somehow hilite or indicate the line 
> that the mouse is over in the field, without disturbing the ability to edit 
> that field (copy, paste, type stuff) with ease.  
> 
> I have tried a few different ways of hiliting the line of the field 
> (selecting it, changing the color of the text of it, etc) but any sort of 
> repeat or recursive structure does not work, as the “mousewithin” message is 
> simply sent far too often for any ‘repeat’ or recursion to work.
> 
> Does anyone have any other ideas for highlighting a line in a field that 
> might work under these conditions?

Mark,

Have you tried setting the backgroundColor of the line, something like this:

local sCurrLine

on mouseWithin
    put the mouseline into tThisLine
    if tThisLine <> sCurrLine then
        set the backgroundColor of line 1 to -1 of me to empty
        set the backgroundColor of tThisLine to (220,220,250)
        put tThisLine into sCurrLine
    end if
end mouseWithin

on mouseLeave
    set the backgroundColor of line 1 to -1 of me to empty
end mouseLeave

It seemed to work okay here on LC 7.1.2.

Devin

Devin Asay
Office of Digital Humanities
Brigham Young University

_______________________________________________
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