how to set the textStyle of word 1 of the selection?
Andre.Bisseret
Andre.Bisseret at inria.fr
Tue Mar 16 11:40:03 EDT 2010
Le 16 mars 10 à 11:40, BNig a écrit :
>
> 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
Bernd, you are absolutely right!
It is a pity! it was so nice ;-)))
Thank you much for this remark.
Then, I am looking for a solution. I will try to control the selection
made by the user and to edit it.
Something like the following (just tested for space at the moment :-))
on mouseUp
local selText,
------
put the selectedText into selText
repeat
if char 1 of selText is space then
put empty into char 1 of selText
else
find whole selText in fld "tText"
if the result is "not found" then exit mouseUp
select the foundChunk
find empty
linkWord1
exit mouseUp
end if
end repeat
end mouseUp
on linkWord1
local selCh,fldRef,fldText,StartChar,wordNbr,selText
put the selectedChunk into selCh
put selCh
if the selectedText = empty then exit linkWord1
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
set the textStyle of word wordNbr of \
fldRef to "link"
end linkWord1
Danke sehr Bernd
André
More information about the use-livecode
mailing list