TX Text Control .NET Server

Javascript: TextFrameCollection.addWithMouse Method

Method|Introduced in 28.0

Description

Inserts a text frame with the built-in mouse interface. The text frame's size is determined through the end-user. A cross cursor indicates where the text frame can be inserted. Changing the document aborts the insertion process.

Syntax

<void> TextFrameCollection.addWithMouse(<TextFrameInsertionMode> insertionMode, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
insertionMode

Specifies how the text flow is handled.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates TextFrameCollection.addWithMouse in a practical document-editing workflow. It inserts a text frame with the built-in mouse interface. The text frame's size is determined through the end-user. A cross cursor indicates where the text frame can be inserted. Changing the document aborts the insertion process.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.textFrames.addWithMouse(TXTextControl.TextFrameInsertionMode.AsCharacter, onTxError);