![]() |
![]() |
The options form (in RapidSpellDialog or invoked programmatically) allows the user to store their own spell check preferences and also edit their user dictionary.
By default, user options are enabled and stored under .NET's IsolatedStorage. It's important to remember that user options (if enabled) will override the properties set in the spell checker controls (eg. RapidSpellAsYouType.CheckAsYouType = true will have no effect if the user has disabled check as you type). Disabling User OptionsSet OptionsEnabled in the RapidSpellDialog and/or RapidSpellAsYouType control. Programmatically Setting User OptionsCall SetUserOptions on the options object and pass the values that should be used. Then call Save to write the changes. In this example we use the existing values (so no changes are made). Dim o As Options.UserOptions = rapidSpellDialog1.Options rapidSpellDialog1.Options.SetUserOptions(o.CheckAsYouType, o.IncludeUserDictionaryInSuggestions, _ o.IgnoreWordsWithDigits, o.IgnoreURLsAndEmailAddresses, o.IgnoreCapitalizedWords, _ o.AllowMixedCase, o.AllowAnyCase, o.FindSuggestions, False) rapidSpellDialog1.Options.Save() } Eg. To change the "Check as you type" option, replace o.CheckAsYouType with either true or false. Changing Storage LocationSet OptionsStorageLocation to either IsolatedStorage (default), FileSystem or Stream see below. Maintaining Separate Options ProfilesSet OptionsFileName in the RapidSpellDialog and/or RapidSpellAsYouType control to a unique name for each separate set of options to use. Resetting / Deleting OptionsCall UserOptions.Delete() to empty the file and allow the default options to be recreated. Eg. RapidSpellDialog.Options.Delete() Launching Options Editor Programmatically
Eg.
OptionsPresenter optionsPresenter = new OptionsPresenter();
if (optionsPresenter.Show(this, rapidSpellAsYouType1.Options))
{
rapidSpellAsYouType1.Options.Save();
}
How To Use A Custom Stream For StorageEvents are available which can be used to determine when to prepare a stream to read/write to. For example, to use a custom stream to write to an XML file;
.........
Public Sub New()
MyBase.New
InitializeComponent
rapidSpellAsYouType1.OptionsStorageLocation = Keyoti.RapidSpell.Options.UserOptions.StorageType.Stream
rapidSpellDialog1.OptionsStorageLocation = Keyoti.RapidSpell.Options.UserOptions.StorageType.Stream
Dim options As Keyoti.RapidSpell.Options.UserOptions = New Keyoti.RapidSpell.Options.UserOptions
options.StorageLocation = Keyoti.RapidSpell.Options.UserOptions.StorageType.Stream
AddHandler options.NeedCustomStreamForSaving, AddressOf Me.NeedSaveStream
AddHandler options.NeedCustomStreamForLoading, AddressOf Me.NeedLoadStream
AddHandler options.OptionsSaved, AddressOf Me.options_OptionsSaved
options.Load
rapidSpellAsYouType1.Options = options
rapidSpellDialog1.Options = options
rapidSpellAsYouType1.TextBoxBase = Me.aytTextBox1
End Sub
Private Sub options_OptionsSaved(ByVal sender As Object, ByVal e As Keyoti.RapidSpell.Event.OptionsSavedEventArgs)
'update the DB?
End Sub
Private Sub NeedSaveStream(ByVal sender As Object, ByVal e As Keyoti.RapidSpell.Options.NeedStreamEventArgs)
e.RequiredStream = New System.IO.FileStream("c:\useropt.xml", System.IO.FileMode.Truncate, System.IO.FileAccess.Write)
End Sub
Private Sub NeedLoadStream(ByVal sender As Object, ByVal e As Keyoti.RapidSpell.Options.NeedStreamEventArgs)
e.RequiredStream = New System.IO.FileStream("c:\useropt.xml", System.IO.FileMode.OpenOrCreate)
End Sub
.........
Note:
|
About | Contact | Site Map | Privacy Policy
Copyright © 2002- Keyoti Inc.