how to set the textStyle of word 1 of the selection?

J. Landman Gay jacque at hyperactivesw.com
Tue Mar 16 22:24:27 EDT 2010


J. Landman Gay wrote:
> J. Landman Gay wrote:
>> Andre.Bisseret wrote:
>>
>>> Then, I am looking for a solution. I will try to control the 
>>> selection made by the user and to edit it.
>>
>> Does this work?
>>
>> on mouseUp
>>   get the selection
>>   put word 1 of it into tWord
>>   if tWord = "" then exit mouseUp
>>   put (word 2 of the selectedchunk)-1 into tStart
>>   set the textstyle of char (offset(tWord,it))+tStart to \
>>     len(tWord)+tStart of fld 1 to "link"
>> end mouseUp
>>
> 
> Answering my own question: no, it doesn't. Not in all cases. Only in some.
> 

So I'm being really stupid today. This should have been pretty obvious:

on mouseUp
   select word 1 of the selection
   if the number of words in the selection = 0 then exit mouseUp
   set the textstyle of the selectedChunk to "link"
end mouseup

Like, duh.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list