problem waiting - spellchecker
MisterX
b.xavier at internet.lu
Tue Aug 30 00:53:58 EDT 2005
Hi everyone
im working on this spellchecker (too) in a palette form. It should be able
to work in any stack... Dictionary is ready, so is the SpellChecker's GUI.
While everything is nearly ready, the stack makes a loop to parse all words
and check each word and waits for a user input to decide what happens to
each unknown word - as expected. but...
Now, the problem is that once a word is detected as unknown, the loop must
wait for the user to hit the buttons "learn, skip, ignore, etc..."
so it goes like this
for each word w in thistext
if w is not in dictionary then
put w into field unknown
put suggestions(w) into field suggestions
wait until checkdone
end if
The skip, continue, etc, buttons contain their functions or change a global
parameter that tell the parser to continue or skip, etc... And at the end,
each button script contains "checkdone".
But while this seemed too simple and easy, it didn't work.
The loop gets stuck waiting blocking the gui completly... Clicking on a
button with the CheckDone caller doesnt work either. Wait just blocks
everything... Control-C is the only way to stop it.
I tried also
wait until the mouse is up/down - it works a bit better but... this gets
complicated, checking all the targets, and unlike a normal word processor,
all the applications are still blocked waiting... There must be an easier
way...
So any suggestions on how to handle this in an "idle" way are welcome.
- I dont want to block the GUI
- The user should be able to edit anything (the correctedtext for example)
meanwhile (put the check in the bg).
- when i pause the loop, any button should be able to work...
- how do you resume a loop in this case?
im thinking of using a parametrable loop that stops at each unknown word
remembering in it's parameters what word that was... Each palette button
(skip, fix, learn, etc) will do it's job and relaunch the spellcheck loop
which will continue at the next word...
But solution 1 was so simple...
Does anyone have a better suggestion?
Thanks in advance
Xavier
More information about the use-livecode
mailing list