TX Text Control .NET Server

Javascript: BarcodeCollection.getItem Method

Method|Introduced in 28.0

Description

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

Syntax

<void> BarcodeCollection.getItem(<RequestBarcodeFrameCallback> callback, [<ErrorCallback> errorCallback], [<number> id])

Parameters

ParameterDescription
callback

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

errorCallback

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

id

Optional. The barcode's identifier.

Examples

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

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

TXTextControl.barcodes.getItem(
    function(barcodeFrame) {
        if (!barcodeFrame) {
            console.warn("No barcode frame was returned.");
            return;
        }
        
        console.log("get item result:", barcodeFrame);
    },
    onTxError,
    25
);