Use MouseLine() and still edit the same field?

Earthednet-wp prothero at earthednet.org
Sat Mar 5 09:56:01 EST 2016


Mark,
I had a situation where it thought I was French. Go to your setups or preferences and look at language settings. I also find that asking Google for info is useful, even for questions about livecode.
Bill

William Prothero
http://es.earthednet.org

> On Mar 5, 2016, at 5:17 AM, Mark Mitchell <cowhead at mac.com> wrote:
> 
> Thanks to Devin, Terry and Matt
> 
> I tweaked Devin’s code a bit, and went with a global variable as otherwise it flashes and gives you an epileptic seizure!
> 
> But, this works great:
> on mouseWithin — seems to work better than mousemove
> global PastWhichLine
> 
>   if pastWhichLine is empty then
>      put the mouseLine into pastwhichLine
>   end if
> 
> put the mouseline into tThisLine
>    if tThisLine <> PastWhichLine then
> 
>       set the backgroundColor of pastwhichline to empty
>       set the backgroundColor of tThisLine to (220,220,250)
>       put tThisLine into PastWhichLine
>   end if
> end mouseWithin
> 
> Thanks folks!
> 
> マーク.. (Apple mail has a bug that automatically changes my name to Japanese and there is no way to stop it… sigh…)
> 
>> 
>>> On Mar 4, 2016, at 1:08 PM, Mark Mitchell <cowhead at 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 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