Highlight list line on hover?

dunbarx at aol.com dunbarx at aol.com
Thu May 12 13:05:11 EDT 2011


Ken.


You just cannot test too much. The "mouseLine" returns empty when the cursor is over space below data in a list field. This causes the selection to revert to line 1. Not sure why.


The fix, if one pursues this solution, is:



on mouseWithin
   if the mouseLine <> "" then select the mouseLine
end mouseWithin


BUT, if you write:



on mouseWithin
   if word 2 of the mouseLine = "" then select empty else select the mouseline
end mouseWithin



Now this works fine, even though it explicitly selects empty instead of letting LC resolve to do so. Seems wrong. Not that it matters much.


It felt like the mouseMove way was more better. Now why does a list field select line 1 when the mouseLine is empty? It cannot be that "select empty" does that.


Craig





-----Original Message-----
From: Ken Ray <kray at sonsothunder.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Thu, May 12, 2011 11:25 am
Subject: Re: Highlight list line on hover?


Craig, I'm not at my computer right now, but did you test your method with a 
field that has less lines of data than the field will display, and then move the 
mouse into the field over an "empty" line?

Perhaps that will generate the error...

Ken Ray
Sons of Thunder Software, Inc.

On May 12, 2011, at 10:16 AM, dunbarx at aol.com wrote:

> Hmmm.
> 
> 
> There is something else going on, because both approaches work identically for 
me. As they ought to. Anyway, as John says, the good news is there is more than 
one way to do almost anyting. I originally did it with a mouseMove as well, and 
now that I think about it, this is likely slightly more robust, even though 
functionally indistinguishable.
> 
> 
> Craig Newman
> 
> 
> 
> 
> 
> -----Original Message-----
> From: John Dixon <dixonja at hotmail.co.uk>
> To: use-livecode at lists.runrev.com
> Sent: Thu, May 12, 2011 10:44 am
> Subject: RE: Highlight list line on hover?
> 
> 
> 
>> I just retried both John's and your scripts, to see if it was me... 
>> • John's does not affect the default list field behaviour - the highlight 
> changes only on mouseDown.
> 
> Keith, the highlight does not change on mouseDown, it changes when the mouse 
is 
> over the line... the first line in the handler is to stop the highlight being 
> set to the first line if the cursor is moved over a line in the field that is 
> empty...
> 
> on mouseWithin
>   if the mouseLine is empty then exit mouseWithin
>   select the mouseLine
> end mouseWithin
> 
> Not that it matters, as one of the nice things about LiveCode is that 
> there is always another way to accomplish something... the purists will 
> 'carp' on about best practices, which always makes me smile... Who is to
> say ?
> 
> Take care... :-)
> 
> 
> 
> 
> _______________________________________________
> 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
> 
> 
> _______________________________________________
> 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


_______________________________________________
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