# SCROLLBAR

## Overview

The `SCROLLBAR` class implements `ISMScrollbar` and `IPrefixedConstantsObject` to provide constants related to scrollbars in a solution model. It includes a `getPrefix` method that returns the prefix `"SM_SCROLLBAR"` for identifying related constants and overrides the `toString` method to provide a descriptive name.

## Constants Summarized

| Type                                                     | Name                                                                 | Summary                                                                                                           |
| -------------------------------------------------------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [HORIZONTAL\_SCROLLBAR\_ALWAYS](#horizontal_scrollbar_always)        | Used to set the horizontal scroll bar policy so that horizontal scrollbars are always displayed.                  |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [HORIZONTAL\_SCROLLBAR\_AS\_NEEDED](#horizontal_scrollbar_as_needed) | Used to set the horizontal scroll bar policy so that horizontal scrollbars are displayed only when needed.        |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [HORIZONTAL\_SCROLLBAR\_NEVER](#horizontal_scrollbar_never)          | Used to set the horizontal scroll bar policy so that horizontal scrollbars are never displayed.                   |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [SCROLLBARS\_WHEN\_NEEDED](#scrollbars_when_needed)                  | Used to set the horizontal and vertical scroll bar policy so that both scrollbars are displayed only when needed. |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [VERTICAL\_SCROLLBAR\_ALWAYS](#vertical_scrollbar_always)            | Used to set the vertical scroll bar policy so that vertical scrollbars are always displayed.                      |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [VERTICAL\_SCROLLBAR\_AS\_NEEDED](#vertical_scrollbar_as_needed)     | Used to set the vertical scroll bar policy so that vertical scrollbars are displayed only when needed.            |
| [Number](/reference/servoycore/dev-api/js-lib/number.md) | [VERTICAL\_SCROLLBAR\_NEVER](#vertical_scrollbar_never)              | Used to set the vertical scroll bar policy so that vertical scrollbars are never displayed.                       |

## Constants Detailed

### HORIZONTAL\_SCROLLBAR\_ALWAYS

Used to set the horizontal scroll bar policy so that horizontal scrollbars are always displayed.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var alwaysScrollbars = form.newField('my_table_text', JSField.TEXT_AREA, 230, 10, 100, 100);
alwaysScrollbars.scrollbars = SM_SCROLLBAR.HORIZONTAL_SCROLLBAR_ALWAYS | SM_SCROLLBAR.VERTICAL_SCROLLBAR_ALWAYS;
```

### HORIZONTAL\_SCROLLBAR\_AS\_NEEDED

Used to set the horizontal scroll bar policy so that horizontal scrollbars are displayed only when needed.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var neededScrollbars = form.newField('my_table_text', JSField.TEXT_AREA, 120, 10, 100, 100);
neededScrollbars.scrollbars = SM_SCROLLBAR.HORIZONTAL_SCROLLBAR_AS_NEEDED | SM_SCROLLBAR.VERTICAL_SCROLLBAR_AS_NEEDED;
```

### HORIZONTAL\_SCROLLBAR\_NEVER

Used to set the horizontal scroll bar policy so that horizontal scrollbars are never displayed.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var noScrollbars = form.newField('my_table_text', JSField.TEXT_AREA, 10, 10, 100, 100);
noScrollbars.scrollbars = SM_SCROLLBAR.HORIZONTAL_SCROLLBAR_NEVER | SM_SCROLLBAR.VERTICAL_SCROLLBAR_NEVER;
```

### SCROLLBARS\_WHEN\_NEEDED

Used to set the horizontal and vertical scroll bar policy so that both scrollbars are displayed only when needed.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var neededScrollbars = form.newField('my_table_text', JSField.TEXT_AREA, 120, 10, 100, 100);
// This is the default option, but if you really want you can set it explicitly.
neededScrollbars.scrollbars = SM_SCROLLBAR.SCROLLBARS_WHEN_NEEDED;
```

### VERTICAL\_SCROLLBAR\_ALWAYS

Used to set the vertical scroll bar policy so that vertical scrollbars are always displayed.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var alwaysScrollbars = form.newField('my_table_text', JSField.TEXT_AREA, 230, 10, 100, 100);
alwaysScrollbars.scrollbars = SM_SCROLLBAR.HORIZONTAL_SCROLLBAR_ALWAYS | SM_SCROLLBAR.VERTICAL_SCROLLBAR_ALWAYS;
```

### VERTICAL\_SCROLLBAR\_AS\_NEEDED

Used to set the vertical scroll bar policy so that vertical scrollbars are displayed only when needed.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var neededScrollbars = form.newField('my_table_text', JSField.TEXT_AREA, 120, 10, 100, 100);
neededScrollbars.scrollbars = SM_SCROLLBAR.HORIZONTAL_SCROLLBAR_AS_NEEDED | SM_SCROLLBAR.VERTICAL_SCROLLBAR_AS_NEEDED;
```

### VERTICAL\_SCROLLBAR\_NEVER

Used to set the vertical scroll bar policy so that vertical scrollbars are never displayed.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
var noScrollbars = form.newField('my_table_text', JSField.TEXT_AREA, 10, 10, 100, 100);
noScrollbars.scrollbars = SM_SCROLLBAR.HORIZONTAL_SCROLLBAR_NEVER | SM_SCROLLBAR.VERTICAL_SCROLLBAR_NEVER;
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoycore/dev-api/solutionmodel/scrollbar.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
