On Jul 7, 2011, at 6:17 PM, Ken Ray wrote: > > 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: k...@sonsothunder.com > Web Site: http://www.sonsothunder.com/
Here's what I have in one of my fields, where I am creating links from time to time: on mouseup -- select the text you want to turn into a link -- then control-click the selectedText -- mouseup is sent when control-clicking in an unlocked field if the environment <> "development" then pass mouseup if $user <> "pmbrig" then exit mouseup -- prevents other users from modifying links if the controlkey is down then put the clickchunk into cc put the clicktext into ctxt put the linktext of cc into linkT -- in case you are modifying an existing link ask "Linktext for '" & ctxt & "'?" with linkT as sheet put result() into r put it into linkT if r = empty then if linkT = empty then -- to remove link & set the text back to normal style set the forecolor of cc to empty set the textstyle of cc to empty set the linktext of cc to empty else set the forecolor of cc to blue set the textstyle of cc to link set the linktext of cc to linkT end if end if else pass mouseup end if end mouseup -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig _______________________________________________ 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