Page 1 of 1

Text behaving as link

Posted: Thu Jan 21, 2010 5:51 pm
by mtecedor
Hi again,

I have a text field and I want several words to behave like links that redirect end users to other cards in the stack. I looked in the dictionary and the user guide, but I could not figure out the way to do it.

Any ideas?

Thanks,

Marta

Re: Text behaving as link

Posted: Thu Jan 21, 2010 6:34 pm
by massung
Example:

1. Create text field named "test"
2. Edit the contents to be "one two three"
3. Set the Locked Text of the field to be true
4. Open the MessageBox and do the following:
4a. set the textStyle of word 1 of fld "test" to "link"
4b. set the textStyle of word 2 of fld "test" to "link"
4c. set the textStyle of word 3 of fld "test" to "link"
5. Open the script for the field and add the following script:

Code: Select all

on linkClicked pLinkName
  answer pLinkName
end linkClicked
Hope this helps!

Jeff M.

Re: Text behaving as link

Posted: Mon Jan 25, 2010 2:08 am
by mtecedor
Thanks a lot Jeff.

That worked. I also found the "link" command under "Text" (Dah!) What I dont like very much is that I cannot change the color when the user passes the mouse over (I am creating a sitemap), so I may have to go with invisible buttons, which seems to me much more time consuming option.

Marta

Re: Text behaving as link

Posted: Mon Jan 25, 2010 3:14 am
by sturgis
The code is a bit ugly, but if you put the following script in your card or stack script it should do the mouse over hilite you want

Code: Select all

on mouseMove -- highlight grouped text
   local tMouseChunk
   global tLastChunk
   put the mouseChunk into tMouseChunk
   if tMouseChunk <> tLastChunk  then
      if tLastChunk is not empty then 
         set the textColor of tLastChunk to empty
         put empty into tLastChunk
      end if
      if the mouseChunk is not empty and "link" is among the items of the textStyle of the mouseChunk then 
         set the textColor of tMouseChunk to "red"
         put tMouseChunk into tLastChunk
      end if
   end if
end mouseMove