TX Text Control .NET Server

Javascript: FrameCollection.getItem Method

Method|Introduced in 28.0

Description

Gets the frame selected by the user or the frame with the specified identifier.

Syntax

<void> FrameCollection.getItem(<RequestFrameBaseCallback> callback, [<ErrorCallback> errorCallback], [<number> id])

Parameters

ParameterDescription
callback

Receives the requested frame or null if there is no frame at the current input position / with the specified identifier.

errorCallback

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

id

Optional. The frame's identifier.

Examples

The following example demonstrates FrameCollection.getItem in a practical document-editing workflow. It gets the frame selected by the user or the frame with the specified identifier.

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

function inspectItem(frames) {
    frames.getItem(
        function(frame) {
            if (!frame) {
                console.warn("No frame base was returned.");
                return;
            }
            
            console.log("get item result:", frame);
        },
        onTxError,
        25
    );
}