Using linkText

Ken Ray kray at sonsothunder.com
Thu Jul 7 18:17:38 EDT 2011


On Jul 7, 2011, at 4:14 PM, Pete wrote:

> Thanks, hadn't noticed that.  But it just seems to make the text a link or
> not, no way to specify what the link should be.
> 
> Maybe I'm misunderstanding the purpose of linkText.  What I want to do is
> have each link go to a specific card in the stack....

All that setting the style of a textrun to "link" does is to display it as a web link and when it is clicked it sends a "linkClicked" message to the field with the first parameter being the text that was clicked. It's up to you to trap the "linkClicked" message and then do something with it.

An alternative method is to set the htmlText of a field to text that includes an "a href=" tag; if you do *that*, the value in "href" is returned as the parameter to linkClicked, NOT the text itself. Consider this HTML chunk:

  <a href="Test">This is a test</a>

The phrase "This is a test" will be underlined and clickable, but when you click it:

on linkClicked pText
  answer pText
end linkClicked

This would answer "Test", not "This is a test".

HTH,


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


More information about the use-livecode mailing list