how to set the textStyle of word 1 of the selection?
J. Landman Gay
jacque at hyperactivesw.com
Wed Mar 17 14:06:34 EDT 2010
BNig wrote:
> Jaque,
> I like your solution a lot. I modified it a bit in case a word is not fully
> selected in the first place. It would only set the textstyle to the selected
> part of the word.
> -------------------------
> on mouseUp
> select word 1 of the selection
> if the number of words in the selection = 0 then exit mouseUp
> put word -1 of the selectedChunk into tFieldNbr
> put the number of words of char 1 to (word 2 of the selectedChunk) of
> field tFieldNbr into tWordNbr
> select word tWordNbr of field tFieldNbr
> set the textstyle of the selectedChunk to "link"
> end mouseup
> -------------------------
> This way a user will have the textstyle of the word changed even if he did
> not include the last letter or two in the selection. Selecting text with a
> mouse can easily be one off for a lot of users.
> regards
> Bernd
Good point, you're right. But I think it needs to use word 4 of the
selectedchunk, or else it fails if the first selected character is a
space. We also don't need the first selection any more.
on mouseUp
if the number of words in the selection = 0 then exit mouseUp
get the selectedchunk
select word (the number of words of char 1 to (word 4 of it) of fld \
(word -1 of it)) of fld (word -1 of it)
set the textstyle of the selectedChunk to "link"
end mouseup
I wanted to keep it to 3 lines again but it got too hard to read. It
isn't all that easy even now...
Love these little brainstorming list things.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list