# LockButtonWidgetHelper.LockButtonBuilder

`com.jsmacrosce.jsmacros.client.api.helper.screen.LockButtonWidgetHelper.LockButtonBuilder`

**Since:** 1.8.4

Builder for a lock button bound to its screen. It starts unlocked unless the
boolean overload of `IScreen.lockButtonBuilder()` specifies otherwise.

Nested type declared in [LockButtonWidgetHelper](LockButtonWidgetHelper.md).

## Constructors

### new LockButtonWidgetHelper.LockButtonBuilder {#com.jsmacrosce.jsmacros.client.api.helper.screen.LockButtonWidgetHelper.LockButtonBuilder_constructor-IScreen-}

```js
new LockButtonWidgetHelper.LockButtonBuilder(IScreen screen)
```

Stores the screen to which `build()` will add the created widget.

**Parameters:**
- `screen`: the screen associated with this builder

## Methods

### action {#com.jsmacrosce.jsmacros.client.api.helper.screen.LockButtonWidgetHelper.LockButtonBuilder_action-MethodWrapper-}

```js
action(MethodWrapper<LockButtonWidgetHelper, IScreen, Object, ?> action): LockButtonWidgetHelper.LockButtonBuilder
```

**Parameters:**
- `action`: callback invoked when the button is pressed; `null` disables it

**Returns:** self for chaining.

**Since:** 1.8.4

### createWidget {#com.jsmacrosce.jsmacros.client.api.helper.screen.LockButtonWidgetHelper.LockButtonBuilder_createWidget-}

```js
createWidget(): LockButtonWidgetHelper
```

Creates the lock-button helper using the configured position, z-index, and initial locked state.  
 If an action is configured, it receives this helper and the associated screen; exceptions are logged.  
 The callback then marks the next release to be skipped only for container screens.  
 This method does not add the widget to the screen or apply the builder's label, size, alpha,  
 active, or visible settings; `build()` performs the addition and applies alpha, active,  
 and visible settings.

**Returns:** the helper for the newly created lock button

### getAction {#com.jsmacrosce.jsmacros.client.api.helper.screen.LockButtonWidgetHelper.LockButtonBuilder_getAction-}

```js
getAction(): MethodWrapper<LockButtonWidgetHelper, IScreen, Object, ?>
```

**Returns:** the configured callback, or `null` if none is set.

**Since:** 1.8.4

### isLocked {#com.jsmacrosce.jsmacros.client.api.helper.screen.LockButtonWidgetHelper.LockButtonBuilder_isLocked-}

```js
isLocked(): boolean
```

Returns the initial locked state configured for this builder. The default is
unlocked; this does not track the button after it is built.

**Returns:** the initial state of the lock button.

**Since:** 1.8.4

### locked {#com.jsmacrosce.jsmacros.client.api.helper.screen.LockButtonWidgetHelper.LockButtonBuilder_locked-boolean-}

```js
locked(boolean locked): LockButtonWidgetHelper.LockButtonBuilder
```

Sets the button's initial locked state; it does not constrain later changes.

**Parameters:**
- `locked`: whether to initially lock the button or not

**Returns:** self for chaining.

**Since:** 1.8.4
