# Javascript: RulerBarViewGenerator.setReadOnly Method

> 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.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 30.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: RulerBarViewGenerator.setReadOnly Method
- **390 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/rulerbarviewgenerator/setreadonly-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/rulerbarviewgenerator/setreadonly-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/rulerbarviewgenerator/setreadonly-method/llms-full.txt

---

### 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

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

### Parameters

| Parameter | Description |
|---|---|
| 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.

```javascript
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
);
```

---

## Nearby

- **Previous:** [Javascript: RulerBarViewGenerator.setFormulaMode Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/rulerbarviewgenerator/setformulamode-method/llms-full.txt)
- **Next:** [Javascript: RulerBarViewGenerator.setScaleUnit Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/rulerbarviewgenerator/setscaleunit-method/llms-full.txt)
