Javascript: TXTextControl.setForeColor Method
Description
Sets the foreground color of the control which is the color of the document's text.
Syntax
<void> TXTextControl.setForeColor(<String> foreColor, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| foreColor | Foreground color. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates TXTextControl.setForeColor in a practical document-editing workflow. It sets the foreground color of the control which is the color of the document's text.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.setForeColor(
"#ffd54f",
function() {
console.log("set fore color completed.");
},
onTxError
);