Javascript: InputPosition.getCaretSize Method
Description
Gets the size of the caret, in pixels, at the current text input position.
Syntax
<void> InputPosition.getCaretSize(<RequestSizeCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives the size of the caret. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates InputPosition.getCaretSize in a practical document-editing workflow. It gets the size of the caret, in pixels, at the current text input position.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.inputPosition.getCaretSize(
function(size) {
if (!size) {
console.warn("No size was returned.");
return;
}
console.log("get caret size result:", size);
},
onTxError
);