multiple-word phrases, links
Chris Sheffield
revlist at cableone.net
Thu Sep 11 09:23:00 EDT 2003
Toma,
Here's a bit of code I use to do just that.
repeat for each line tPhrase in thePhrases]
if matchChunk(fld "MyText", "(" & tPhrase & ")", tStartChar, tEndChar)
then
set the textStyle of char tStartChar to tEndChar of fld "MyText" to
link
end if
end repeat
Of course, you only have to use the repeat if you have multiple phrases.
The matchChunk function returns a Boolean true or false if the text is
found. The parentheses are necessary to match a patter of multiple words.
The beginning and ending characters are stored in whatever variables you
specify, in this case tStartChar and tEndChar. So then you just use those
in a chunk expression to set your link.
Hope that helps.
Chris Sheffield
Software Development
Read Naturally
csheffield at readnaturally.com
-----Original Message-----
From: use-revolution-admin at lists.runrev.com
[mailto:use-revolution-admin at lists.runrev.com] On Behalf Of Toma Tasovac
Sent: Thursday, September 11, 2003 3:21 AM
To: use-revolution at lists.runrev.com
Subject: multiple-word phrases, links
Hi there.
I have a list containing various multiple-word phrases and I want
Revolution to find those phrases in a text field and turn them into
links (the whole phrase, not individual words). What's the best way of
doing this? I can use wordOffset for each individual word in the
phrase and then make sure that the offsets are next to each other in
the text, but that sounds horrible. There has to be a better way.
Helplessly yours,
Toma
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list