André,
this works most of the time, since a user can select into spaces, returns and tabs etc. This assumes that a real word starts with an ASCII value below 48. So many of the interpunctation is in that range, but not all. -------------------------------- on mouseUp put the selectedChunk into tSelect put field 1 into tData -- no selection made of just a click into the field if tSelect is "" or word 4 of tSelect < word 2 of tSelect then exit mouseUp put word 2 of tSelect into tStartChar put word 4 of tSelect into tEndChar put tStartChar into tBeginOfWord -- selection can start with space, return or other non-letters -- the test for number of words later on would return -- the word before the intended word repeat with i = tStartChar to tEndchar if chartoNum (char i of tData) > 47 then exit repeat else add 1 to tBeginOfWord end if end repeat -- if tBeginOfWord <= tEndchar then set the textstyle of word (the number of words of char 1 to tBeginOfWord of tData) of field 1 to "link" else -- optional answer "please include at least part of a word in the selection" end if end mouseUp ----------------------- may be there is a smarter way. regards Bernd -- View this message in context: http://n4.nabble.com/how-to-set-the-textStyle-of-word-1-of-the-selection-tp1593292p1593371.html Sent from the Revolution - User mailing list archive at Nabble.com. _______________________________________________ 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