Just a thought that might be a lot more helpful...

Given the context of this application, and the fact that you probably don't
want the quotes (and other punctuation) to be highlighted/underlined, I'd
just use a regular expression like so (untested):

function getNextWord pText, pFrom
  local tStart, tEnd

  if matchChunk(char pFrom to -1 of pText, "([-A-Za-z0-9_]+)", tStart, tEnd)
is false then
    return empty -- no more words
  end if

  add pFrom to tStart
  add pFrom to tEnd

  return tStart,tEnd
end getNextWord

And now you can use this function in succession for you spacebar routine...


## in the field...

local sLastWord

command highlightNextWord
  -- remove the underline from the last word
  if sLastWord is not empty then
    set the textStyle of char item 1 of sLastWord to item 2 of sLastWord of
me to "normal"

    -- search for the next word from the last word's offset
    put getNextWord(me, item 2 of sLastWord + 1) into sLastWord
  else
    put getNextWord(me, 0) into sLastWord
  end if

  -- underline the next word
  if sLastWord is not empty then
    set the textStyle of char item 1 of sLastWord to item 2 of sLastWord of
me to "underline"
  end if
end highlightNextWord

Jeff M.
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to