On Mar 16, 2010, at 6:40 AM, BNig wrote:
André,
I would test Peters solution a little more. If you start your
selection with
a space the word before the space will be the one that is targeted
for your
textstyle. The same with return and tab.
regards
Bernd
True. I was assuming that the beginning of the selection would be a
character and not white space. Here's a function that tells you if the
character in a field is white space or not:
function isWhiteSpace charNbr,fldRef
put value(fldRef) into fldText
put the number of words of char 1 to charNbr of fldText \
into firstPartCount
put the number of words of char charNbr to -1 of fldText \
into secondPartCount
return firstPartCount + secondPartCount = \
the number of words of fldText
end isWhiteSpace
So incorporating that into the handler would give:
on mouseup
put the selectedchunk into selCh
if the selectedtext = empty then exit mouseup
put the long id of the selectedfield into fldRef
put value(fldRef) into fldText
put word 2 of selCh into startChar
put the number of words of char 1 to startChar \
of fldText into wordNbr
if isWhiteSpace(startChar,fldRef) then add 1 to wordNbr
set the textstyle of word wordNbr of \
fldRef to "link"
end mouseup
On a different note, I'm confused about the behavior of full control
references, eg, fldRef in the above example, which contains a long id
of a field. The last line of the mouseup handler works, because the
engine evaluates the variable fldRef before executing the command, but
if instead of "set the textstyle of word wordNbr of fldRef" you do this:
put word wordNbr of fldRef
you get the corresponding word of "field id 3521 of card id 1009 of
stack..." -- ie, the unevaluated string contained in the variable
fldRef.
So under what circumstances does Rev evaluate a full control
reference? It's clearly not in all contexts.
-- Peter
Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution