De-Hiliting Text

Date:    Sat, 16 Sep 1995 14:09:52 EDT
From:    John Dowdell <71333.42@COMPUSERVE.COM>
Subject: Re: how to hilite text
The Lingo term "hilite" is a command and not a property, so we cannot "set the hilite of field 'yadda' to FALSE". Likewise, any argument to that command which cannot be sensibly evaluated will cause the entire field to hilite, as in "hilite char 0 of field 'yadda'". And as you found out, the "delete" command serves an entirely different purpose from what you wish here.

But... any refresh to the contents of this textfield will remove that transient hilite. If you "put the text of field 'yadda' into field 'yadda'" then this will remove the hilite. In this case you'll lose any custom formatting of individual characters, however. The key is to find a textfield property which applies to the entire field. I believe the following will do what you wish:

  set the textAlign of field "yadda" to the textAlign of field "yadda"
This refreshes the entire field and will remove any highlight you've applied. Weird, yes, but the above's the logic behind it.

btw, the handler you include in your post could conceivably produce unexpected results, particularly on fast machines. When using the "mouseWord" or similar properties in a handler, I'll usually capture this value at the very top of the handler and stuff it into a local variable. Otherwise, if calling that function multiple times within a handler, a twitchy user could conceivably change that value out from under you. Hope this does the trick!


Date:    Mon, 18 Sep 1995 03:47:37 -0500
From:    "Glenn M. Picher" <gplists@IBM.NET>
Subject: Re: how to hilite text

>I am having trouble figuring out how to highlite my text.
>hilite word currentword of field "story1"
If it's not an editable text sprite, try...
   set the hilite of field "story1" to false

If it is an editable text sprite, try...

  set the selStart to 0
  set the selEnd to 0
This also can be used to hilite text or place the cursor within editable text fields. The text selected can be accessed with "the selection".

You can also control which field the cursor is on by "tickling" the sprite. The last tickled sprite will have the cursor. To "tickle" a sprite...

  set the editableText of sprite n to true
John Dowdell, who is almost always correct on matters of fact (if not of opinion :) ), stated:
>The Lingo term "hilite" is a command and not a property, so we cannot "set the
>hilite of field 'yadda' to FALSE".
In this case, John's wrong. Try it. It works. Maybe it's undocumented, but it works. I didn't verify it in a projector but it oughtta work. Oddly enough, it also undoes the hilite if you set it to true !