DS Server

Javascript: Selection.setLength Method

Method|Introduced in 24.0

Description

Sets the number of selected characters.

Syntax

<void> Selection.setLength(<number> length, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
length

The number of selected characters.

callback

Optional. Is called when the operation completed.

errorCallback

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

Examples

The following example demonstrates Selection.setLength in a practical document-editing workflow. It sets the number of selected characters.

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

TXTextControl.selection.setLength(
    5,
    function() {
        console.log("set length completed.");
    },
    onTxError
);