Thanks Craig and Dave - I used Dave's suggestion (mainly because I'm not very familiar with using graphics in LC) and all seems to be working fine now.
The only remaining issue I have now is how to figure out if I entered the field via a mouse click or a tab key. Right now I have a tabKey handler in the control whose layer is 1 less than the layer of my text field. In it, I set a custom property of the text field to indicate that I entered it via the tab key and check for that in the openField handler of the text field. For some reason, pressing tab in the control whose layer is 1 less than the text field doesn't give focus to the text field. It's traversalOn property is true and lockText is false. Any other reasons why I can't tab to it? Or maybe there's a better way to deal with this situation? Thanks, Pete Molly's Revenge <http://www.mollysrevenge.com> On Tue, Sep 27, 2011 at 3:23 PM, <dunb...@aol.com> wrote: > 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 <p...@mollysrevenge.com> > To: How to use LiveCode <use-livecode@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@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@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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode