TX Text Control .NET Server

Activate Method

Method|Introduced in 22.0
Namespace
TXTextControl.Web
Package
TXTextControl.Web as TXTextControl.Web.DocumentEditor.dll from nuget.org, the private NuGet feed or Text Control Offline Packages

Description

Sets the input focus to the specified text part. If the activated text part is not in the visible part of the document, the document is scrolled.

Syntax

public bool Activate(IFormattedText textPart);

Parameters

ParameterDescription
textPart

Specifies the text part to activate. Must be an object of the type Web.MainText, Web.TextFrame or Web.HeaderFooter.

Return Value

The return value is true, if the specified text part could be activated. Otherwise it is false.

Examples

The following example activates the first available web text part so subsequent editor commands target that part.

foreach (TXTextControl.Web.IFormattedText textPart in textPartCollection)
{
    if (textPartCollection.Activate(textPart))
    {
        Console.WriteLine("The text part is active.");
        break;
    }
}