Javascript: TextFrameCollection.getItem Method
Description
Gets the text frame selected by the user or the text frame with the specified identifier.
Syntax
<void> TextFrameCollection.getItem(<RequestTextFrameCallback> callback, [<ErrorCallback> errorCallback], [<number> id])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the requested text frame or null if there is no text frame at the current input position / with the specified identifier. |
| errorCallback | Optional. Is called when the operation failed with an error. |
| id | Optional. The text frame's identifier. |
Examples
The following example demonstrates TextFrameCollection.getItem in a practical document-editing workflow. It gets the text frame selected by the user or the text frame with the specified identifier.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textFrames.getItem(
function(textFrame) {
if (!textFrame) {
console.warn("No text frame was returned.");
return;
}
console.log("get item result:", textFrame);
},
onTxError,
25
);