auto-hilite text vs. scripting the hilite

Éric Chatonet eric.chatonet at wanadoo.fr
Tue Sep 28 02:38:30 EDT 2004


On Sep 27, 2004, at 1:27 PM, RGould8 at aol.com wrote:

> I've got a text field that contains a list of filenames, along with 
> commands
> to "Download", and "View", like this:
>
> Filename1          Download     View
> Filename2          Download     View
> Filename3          Download     View
> Filename4          Download     View
>
>
>  What I want to do is make it so that I can trap that the user has 
> clicked on
> the word "Download" or "View".   I am presently doing this 
> successfully using
> the mouseText function and trapping for "Download" or "View"
>
> However, I also want to allow the user to click on the filename, 
> hiliite it,
> and hit the Delete key to delete the file.   In order to do that, it 
> seems
> like I need to turn on the "auto hilite text" checkbox, and turn on 
> the "use list
> behavior" checkbox.   However, when I do that, my ability to trap for 
> the
> individual word on a line goes away (the mouseText then returns the 
> text for the
> entire line, so I can't trap for Download or View anymore)
>
> Is there a way I can hilite a line within a text field and still 
> permit "the
> mousetext" command to work?   (So that it only returns the word the 
> user has
> clicked on)
>
> OR, if there was a way to set the hilite of a line via Transcript - - 
> that
> seems like it would work too - - - however, I've found that it only 
> works if I
> have the "auto hilite/Listbox" checkboxes turned on for the field.

To avoid problems, you could turn on listBehavior and combine the 
hilitedLine and the clickH:

if (the clickH > item n of the tabStops of me) and \
(the clickH < item (n + 1)  of the tabStops of me) then

See the script of field Controls in Rev Application Browser which uses 
this method.
Hope this helps.

Amicalement,

Éric Chatonet
24, Boulevard de Port-Royal
75005 Paris

Fixe :		33 1 43 31 77 62
Mobile :		33 6 20 74 50 89



More information about the use-livecode mailing list