Linked text in a field as a form

Ken Ray kray at sonsothunder.com
Sat Nov 11 18:09:01 EST 2006


On 11/11/06 4:37 PM, "Bill Vlahos" <bvlahos at mac.com> wrote:

> The following handler in the locked field will give me the grouped text
> itself:
> on linkClicked theText
>    put theText
> end linkClicked
> 
> ...but it won't tell me
> 1. Which group it was in the field (can I identify multiple linked
> texts in a field)?
> 2. How do I replace the original text group? (I.e. put varText into
> group 2 of field "form")
> 3. How do I keep the replaced text also as a group?

You should be able to use "the target"... here's how this would work:

on linkClicked pText
  put the long id of the target into tTarget
  ask "Replacement:"
  if it <> "" then
    do "put it into" && tTarget
    set the textStyle of char 1 to \
       length(the text of tTarget) of tTarget to link
  end if
end linkClicked

Have fun!

Ken Ray
Sons of Thunder Software, Inc.
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com





More information about the use-livecode mailing list