DS Server

Javascript: TXTextControl.setInputPositionByTextPosition Method

Method|Introduced in 30.0

Description

Sets a new input position from a text position.

Syntax

<void> TXTextControl.setInputPositionByTextPosition(<number> textPosition, <TextFieldPosition> textFieldPosition, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
textPosition

Specifies a text position. The first position is zero.

textFieldPosition

If the textPosition parameter is a position at the beginning or at the end of a TextField with a doubled input position, this parameter can be used to define whether the position is inside or outside the field.

callback

Optional. Is called when the operation completed.

errorCallback

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

Examples

The following example demonstrates TXTextControl.setInputPositionByTextPosition in a practical document-editing workflow. It sets a new input position from a text position.

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

TXTextControl.setInputPositionByTextPosition(
    -1,
    TXTextControl.TextFieldPosition.InsideTextField,
    function() {
        console.log("set input position by text position completed.");
    },
    onTxError
);