Guten tag Bernd,

Le 15 mars 10 à 14:43, BNig a écrit :


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.

Yesss! you are right: doing some trials I had just included a space in my selection ;-))
I am going to improve my script to take your suggestion into account.
Actually, I have spaces, tabs and carriage returns in the field; otherwise there are only numbers (it is a field where the day numbers are displayed in an annual calendar (one line for each month) and where the user can select periods).

Vielen dank

André




--------------------------------
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



_______________________________________________
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

Reply via email to