Managing the hilite color of selected text

dunbarx at aol.com dunbarx at aol.com
Tue Sep 27 17:23:20 CDT 2011


Pete:


Why not place a colored graphic over the selectedText? I have done this, and though it seems like a kluge, well, it is a kluge, it is noneTheLess simple and effective.


Craig Newman





-----Original Message-----
From: Pete <pete at mollysrevenge.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Tue, Sep 27, 2011 12:21 pm
Subject: Managing the hilite color of selected text


LC does not retain the hilite of any selected text in a field once you click
on another control and does not restore it when you click back into the
field again.  I'm hoping to find a generalised solution to this.

In other applications, it seems that the standard way of working is:

- change the hilite of any selected text in a field to a light grey color
when another control is clicked

- change the hilite back to the blue hilite color if the user tabs back into
the field

- clear the hilite completely if the user clicks back into the field

That's the behavior I'm aiming for.

So far, I have:

- a mouseLeave handler that sets a custom property of the field to its
selectedChunk  and changes the backgroundcolor of the selectedchunk to gray

- a mouseEnter handler that uses the custom property to set the
backgroundcolor of the selected text back to blue again.

So far so good.  What remains is to handle what happens when the user
arrives back into the field either by tabbing into it or by clicking into
it.

So far I have tried to use an openField handler to achieve this.  Right now,
I'm just trying to deal with the situation where the user clicks back into
the field, by setting the background color of the field to either empty or
white, but neither method removes the highlight from the selected text and
if I type more text into the field, it appears with the hilite background
color.  Even if I delete all the text in the field and type new text in, it
still appears with the blue background color.

The other issue is how to distinguish between the user clicking into the
field and tabbing into it.

I'm pretty sure this must have come up before so hoping for some guidance
from anyone who has come up with the solution.

Thanks,



Pete
Molly's Revenge <http://www.mollysrevenge.com>
_______________________________________________
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