DS Server

Javascript: RulerBarViewGenerator.setReadOnly Method

Method|Introduced in 30.0

Description

Sets a value determining the ruler bar's read only mode. When the ruler bar is set to read only, it still shows all formatting attributes of the connected TextControl, but formatting attributes cannot be changed.

Syntax

<void> RulerBarViewGenerator.setReadOnly(<boolean> value, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
value

The property value.

callback

Optional. Is called when the operation completed.

errorCallback

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

Examples

The following example demonstrates RulerBarViewGenerator.setReadOnly in a practical document-editing workflow. It sets a value determining the ruler bar's read only mode. When the ruler bar is set to read only, it still shows all formatting attributes of the connected TextControl, but formatting attributes cannot be changed.

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

TXTextControl.rulerBar.setReadOnly(
    true,
    function() {
        console.log("set read only completed.");
    },
    onTxError
);