TX Spell .NET for Windows Forms

SetCurrent Method

Method|Introduced in 6.0
Namespace
TXTextControl.Proofing
Package
TXTextControl.TXSpell.WinForms.SDK as TXSpell.dll from the private NuGet feed or Text Control Offline Packages
Also in
TXTextControl.TXSpell.Core.SDK as TXSpell.dll

Description

Sets an object of type TXTextControl.TextControl or text for user interface based spelling correction. Furthermore, overloads of the method determine and set a specific incorrect or misspelled (TXTextControl.MisspelledWord) word based on a specific text position to handle it by the SpellingCorrectionUIProvider.

Syntax

SetCurrent(object)

Sets an object of type TXTextControl.TextControl as CurrentTextControl to handle it by the SpellingCorrectionUIProvider. If the parameter is not null, the first TXTextControl.MisspelledWord of the TextControl is set as CurrentWordToCorrect and the corresponding TXTextControl.IFormattedText object as CurrentIFormattedText. Otherwise the SpellingCorrectionUIProvider's mode is reset to InitialState. If the TXTextControl.TextControl parameter does not contain misspelled words, the mode is set to NoWordsToCorrectFound.

public void SetCurrent(object textControl);
ParameterDescription
textControl

The object of type TXTextControl.TextControl that is handled by the SpellingCorrectionUIProvider.

SetCurrent(string)

Sets the text that is handled by the SpellingCorrectionUIProvider as current text. If the parameter is not null, the first incorrect word of the text is set as CurrentWordToCorrect. Otherwise the SpellingCorrectionUIProvider's mode is reset to InitialState. If the text parameter does not contain incorrect words, the mode is set to NoWordsToCorrectFound.

public void SetCurrent(string text);
ParameterDescription
text

The text that is handled by the SpellingCorrectionUIProvider.

Return Value

SetCurrent methods including a textPosition parameter return true if the corresponding CurrentWordToCorrect property is changed on calling this method. Otherwise false.

Examples

The following example uses Set Current in a focused State Manager workflow. The created object is then available to the surrounding document workflow.

stateManager.SetCurrent("Approved");
Console.WriteLine("State Manager is ready for use.");

Remarks

Throws an exception if the IsOptionsSettings property is set to true.