Spell checking in Rev apps?
Jonathan Lynch
jonathandlynch at gmail.com
Tue Feb 21 09:38:05 EST 2006
I have apps I created for my job that do spellchecking. Works great.
What you do is load the word list into a custom property of your stack for
storage
Then use a script like this:
on preopenstack
global gWordList
put the listofwords of me into tList
repeat for each word tWord in tList
put "true" into gWordList[tWord]
end repeat
end preopenstack
This creates a global array with each element named after each word in your
word list, with "true" as the content of that array.
Then, when you check words, you do something like this:
on closefield
lock screen
global gWordList
put 0 into tCount
repeat for each word tWord in me
add 1 to tCount
if not gWordList[tWord] then set the bgcolor of word tCount of me to
yellow
end repat
end closefield
This checks, for each word in the field, to see if that word is a part of
the global array, and if it contains the word "true" ("if not" is a
shorthand way of doing that)
There are lots of nuances, of course, depending on how you want to handle
punctuation - but that is relatively straight forward text manipulation.
good luck,
Jonathan
More information about the use-livecode
mailing list