Managing the hilite color of selected text

dunbarx at dunbarx at
Tue Sep 27 18:23:20 EDT 2011


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>
To: How to use LiveCode <use-livecode at>
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

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.


Molly's Revenge <>
use-livecode mailing list
use-livecode at
Please visit this url to subscribe, unsubscribe and manage your subscription 


More information about the Use-livecode mailing list