Saving user option settings
You
are here: Home > Support
> WSpell
WSpell includes an option dialog that can be presented to your
applications' users to let them customize the spell checker's
behavior to suit personal preferences. Changes made by the user via
the option dialog affect certain WSpell properties. These property
changes are not saved by WSpell. They remain in effect only
until your application exits. (Property settings made at design time
using a property editor are saved by your development environment.)
If you want the option settings made by the user via the option
dialog at run time to be saved, your application will have to save
the associated WSpell properties. In addition, your application will
have to restore the properties from the saved values when it starts.
Option settings are usually saved in the system registry, in the
HKEY_CURRENT_USER tree.
The option dialog can be displayed in two ways. If your application
uses WSpell's built-in spell checker dialog, the option dialog is
displayed if the user clicks the Options button while the spell
checker dialog is visible. There is no way for your application to
determine if this happens. The option dialog is also displayed if
your application invokes WSpell's ShowOptionDialog method. Because
there is no way to determine if the option dialog was displayed, the
safest approach is for your application to save the relevant WSpell
properties before it exits and to load them when it starts.
The following WSpell properties may be altered by the option dialog:
-
AutoCorrect
- CaseSensitive
- CatchDoubledWords
- IgnoreAllCapsWords
- IgnoreCapitalizedWords
- IgnoreDomainNames
- IgnoreMixedCaseWords
- IgnoreWordsWithDigits
- PhoneticSuggestions
- TypographicalSuggestions
In Visual Basic, application settings can be saved via the
SaveSetting statement. You can save the WSpell properties in an
application called "MyApp" using statements such as the following: SaveSetting "MyApp", "Spelling", "AutoCorrect", WSpell1.AutoCorrect SaveSetting "MyApp", "Spelling", "CaseSensitive", WSpell1.CaseSensitive SaveSetting "MyApp", "Spelling", "CatchDoubledWords", WSpell1.CatchDoubledWords SaveSetting "MyApp", "Spelling", "IgnoreAllCapsWords", WSpell1.IgnoreAllCapsWords SaveSetting "MyApp", "Spelling", "IgnoreCapitalizedWords", WSpell1.IgnoreCapitalizedWords SaveSetting "MyApp", "Spelling", "IgnoreDomainNames", WSpell1.IgnoreDomainNames SaveSetting "MyApp", "Spelling", "IgnoreMixedCaseWords", WSpell1.IgnoreMixedCaseWords SaveSetting "MyApp", "Spelling", "IgnoreWordsWithDigits", WSpell1.IgnoreWordsWithDigits SaveSetting "MyApp", "Spelling", "PhoneticSuggestions", WSpell1.PhoneticSuggestions SaveSetting "MyApp", "Spelling", "TypographicalSuggestions", WSpell1.TypographicalSuggestions
The property values can be restored when "MyApp" starts
using statements such as the following: WSpell1.AutoCorrect = GetSetting("MyApp", "Spelling", "AutoCorrect", True) WSpell1.CaseSensitive = GetSetting "MyApp", "Spelling", "CaseSensitive", True) WSpell1.CatchDoubledWords = GetSetting "MyApp", "Spelling", "CatchDoubledWords", True) WSpell1.IgnoreAllCapsWords = GetSetting "MyApp", "Spelling", "IgnoreAllCapsWords", True) WSpell1.IgnoreCapitalizedWords = GetSetting "MyApp", "Spelling", "IgnoreCapitalizedWords", False) WSpell1.IgnoreDomainNames = GetSetting "MyApp", "Spelling", "IgnoreDomainNames", True) WSpell1.IgnoreMixedCaseWords = GetSetting "MyApp", "Spelling", "IgnoreMixedCaseWords", True) WSpell1.IgnoreWordsWithDigits = GetSetting "MyApp", "Spelling", "IgnoreWordsWithDigits", True) WSpell1.PhoneticSuggestions = GetSetting "MyApp", "Spelling", "PhoneticSuggestions", False) WSpell1.TypographicalSuggestions = GetSetting "MyApp", "Spelling", "TypographicalSuggestions", True)
In MFC, boolean property values are saved using CWinApp's
WriteProfileInt method using statements similar to the following: AfxGetApp()->WriteProfileInt("Spelling", "AutoCorrect", m_wspellCtrl.GetAutoCorrect()); AfxGetApp()->WriteProfileInt("Spelling", "CaseSensitive", m_wspellCtrl.GetCaseSensitive()); AfxGetApp()->WriteProfileInt("Spelling", "CatchDoubledWords", m_wspellCtrl.GetCatchDoubledWords()); AfxGetApp()->WriteProfileInt("Spelling", "IgnoreAllCapsWords", m_wspellCtrl.GetIgnoreAllCapsWords()); AfxGetApp()->WriteProfileInt("Spelling", "IgnoreCapitalizedWords", m_wspellCtrl.GetIgnoreCapitalizedWords()); AfxGetApp()->WriteProfileInt("Spelling", "IgnoreDomainNames", m_wspellCtrl.GetIgnoreDomainNames()); AfxGetApp()->WriteProfileInt("Spelling", "IgnoreMixedCaseWords", m_wspellCtrl.GetIgnoreMixedCaseWords()); AfxGetApp()->WriteProfileInt("Spelling", "IgnoreWordsWithDigits", m_wspellCtrl.GetIgnoreWordsWithDigits()); AfxGetApp()->WriteProfileInt("Spelling", "PhoneticSuggestions", m_wspellCtrl.GetPhoneticSuggestions()); AfxGetApp()->WriteProfileInt("Spelling", "TypographicalSuggestions", m_wspellCtrl.GetTypographicalSuggestions());
The property values can be restored when the application starts using
statements similar to the following: m_wspellCtrl.SetAutoCorrect(AfxGetApp()->GetProfileInt("Spelling", "AutoCorrect", TRUE); m_wspellCtrl.SetCaseSensitive(AfxGetApp()->GetProfileInt("Spelling", "CaseSensitive", TRUE); m_wspellCtrl.SetCatchDoubledWords(AfxGetApp()->GetProfileInt("Spelling", "CatchDoubledWords", TRUE); m_wspellCtrl.SetIgnoreAllCapsWords(AfxGetApp()->GetProfileInt("Spelling", "IgnoreAllCapsWords", FALSE); m_wspellCtrl.SetIgnoreCapitalizedWords(AfxGetApp()->GetProfileInt("Spelling", "IgnoreCapitalizedWords", FALSE); m_wspellCtrl.GetIgnoreDomainNames(AfxGetApp()->GetProfileInt("Spelling", "IgnoreDomainNames", TRUE); m_wspellCtrl.GetIgnoreMixedCaseWords(AfxGetApp()->GetProfileInt("Spelling", "IgnoreMixedCaseWords", TRUE); m_wspellCtrl.GetIgnoreWordsWithDigits(AfxGetApp()->GetProfileInt("Spelling", "IgnoreWordsWithDigits", TRUE); m_wspellCtrl.GetPhoneticSuggestions(AfxGetApp()->GetProfileInt("Spelling", "PhoneticSuggestions", FALSE); m_wspellCtrl.GetTypographicalSuggestions(AfxGetApp()->GetProfileInt("Spelling", "TypographicalSuggestions", TRUE);
Back to WSpell Support Page |
Site index:
|