Spellcheck Object Guide

So it seems that nobody is too sure how to use the Spellcheck object. It is a pro-only extension, and it never had a step-by-step tutorial, so here one is. It is based on my post on the Clickteam Forums.

Stage 1: Load a dictionary

Obviously the spell-checker doesn’t work without a dictionary. Luckily, the example pack comes with two dictionaries. We’ll just use the smaller word list for now, but there is a larger one too. The larger dictionary includes some common spelling errors itself as it is based on common search terms, and so is best avoided.

Insert the object into the frame and don’t change anything on the dialog box. Most of these settings are only required for advanced use, and you won’t need any for a while yet.

Now, create a  ‘Start of frame‘ condition and add the Spellcheck action ‘Load Wordlist (Pauses MMF)‘, as shown in the screenshot below:

Choose ‘Smaller Wordlist.nswl‘ as the dictionary, which, as mentioned earlier, can an be downloaded as part of the example pack.

If you run the program, nothing happens. That is because it loads the dictionary, and then does nothing with it. If you are running on a particularly slow computer, or loading the file from a slow location, you might see a delay whilst it loads, but that is it.

We got to make it do something. Hence, stage 2.

  1. ‘NSWL’ stands for ‘Null separated word list‘. This means that each word in the dictionary is separated by a ‘null character’. (ASCII value 0). Words can also be separated by new lines, but as a new line in Windows is 2 characters using null characters saves a little bit of space.
  2. It is also OK to load one dictionary then another, and the object will then have a dictionary with both the details.

Stage 2: Checking if a word is in the dictionary

We can check if a word is in the dictionary by using the ‘Is Word correct?’ condition. So, let us make an edit box with a button which tells us what is the case.

Insert the button and edit box into the frame as you normally would. We wish to make to events: One which fires when the button is clicked and the word in the edit box has been spelled correctly, and the other when it is clicked but is not. For this, we will use the “Is Word Correct?” condition:

Add the condition “On Button Clicked” + “Is [Text of edit box] correct?” and provide some effect, like setting a string to “Is in dictionary”. Then have the same event but with the second condition negated and have it do something like set a string to “Is not in dictionary”. It should look something like this:

Run it and hopefully you will see that, for instance, “Hello” is in the dictionary but “Hellop” is not.

  1. For more advanced use you can load it in the background with the ‘Load Wordlist in Background‘ action and update a progress bar using ‘LoadingPercentage‘ expression, but for now we’ll just let it pause your program whilst it is loading. The frame cannot change before it has finished loading, though! Change the example so that it does it that way.
  2. All Spellcheck objects share the same dictionary, so if you load it on the first frame and use it again on the second, you don’t need to reload it. Test this by loading the dictionary and checking the words in different frames.

Stage 3: Getting suggestions

Now this is not very exciting. However, we can get suggestions using the object. To do this, you get the incorrectly spelt word and pass it to “List Suggestions” action. This doesn’t directly do anything, but it does cause the ‘On Correction Suggestion‘ event to get triggered once per suggestions.

So add a list box, and when an incorrect word is found you should clear the list box it and then call ‘List suggestions’, adding the suggestion to the list each time. Use the ‘Suggestions -> Get Suggestions’ (Suggestion$) expression to get the name of the current suggestion.

Download this as an example here

Tweak the settings on the first page of dialog box to change how the results are returned.

The Next Step

The next step is to spell-check sentences. This is explained in Part II.


2 Responses to Spellcheck Object Guide

  1. RGBreality says:

    Hey, Jax! Great tutorial! (Actually, I read this tutorial when you first posted it on ClickTeam’s forum, as I was the person who asked for details how the Spellcheck object works.)

    One question I still have, though, is whether there is a way for the Spellcheck object to highlight the word in the sentence which is misspelled. Much like other spellcheckers, if the misspelled word is in a relatively long paragraph, then it becomes challenging for the user to find their misspelled word in the paragraph itself to verify that they did indeed misspell it (and to get context, such as whether the word is properly spelled because it is a proper noun).

    So, I wonder if there is a way for the Spellcheck object to highlight the misspelled term, or how that would be done using MMF2? Any ideas?

    Thanks again for the great tutorial, and even more so for the awesome Spellcheck object!

    Most sincerely,


  2. Pingback: Spell checking a Sentence « Jack's Personal Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: