Skip to content

SBSliderButton

Nikita Yudin edited this page May 4, 2024 · 3 revisions

SBSliderButton icon SBSliderButton

Inherits: SBButton

A button with a horizontal slider.

Description

Used to adjust a value by moving a grabber along a horizontal axis.

Properties

Includes all Slider properties, see Slider. Let's look on list of all available properties:

Name Type Default Description
editable bool true If true, the slider can be interacted with. If false, the value can be changed only by code.
scrollable bool true If true, the value can be changed using the mouse wheel.
tick_count int 0 Number of ticks displayed on the slider, including border ticks. Ticks are uniformly-distributed value markers.
ticks_on_borders bool false If true, the slider will display ticks for minimum and maximum values.
value_label_visibility Visibility Visibility.NEVER Visibility of the value label.
value_label_placement ValuePlacement ValuePlacement.RIGHT Placement of the value label.
value_separation int 0 Separation for the value.
value_label_custom_format String "" Specifies the custom format for the value display. Requires exactly one placeholder (%s/%d/%f). You can also use it to display suffixes etc. Leave empty for no formatting.
value_tooltip_visibility Visibility Visibility.NEVER Visibility of the value tooltip.
value_tooltip_placement ValuePlacement ValuePlacement.TOP Placement of the value tooltip.
value_tooltip_separation int 4 Separation for the value tooltip.
value_tooltip_custom_format String "" Specifies the custom format for the value display. Requires exactly one placeholder (%s/%d/%f). You can also use it to display suffixes etc. Leave empty for no formatting.
navigation bool true Set to true to enable navigation using next and prev buttons.
focus_nav bool false Should the naviation only appear when the button is in focus.
nav_separation int 0 Sets the separation between navigation buttons.
nav_theme Theme The theme used for the navigation buttons.
nav_button_flat bool true The theme used for the navigation buttons.
next_icon Texture2D The texture used for the next navigation button.
prev_icon Texture2D The texture used for the previous navigation button.
pagination bool false Set to true to enable pagination.
clickable_bullets bool false If true then clicking on pagination button will cause transition to appropriate item.
fill_bullets bool false Whether the bullets have to fill all the available space.
focus_bullets bool false Should bullets be displayed when the button has focus.
bullet_size Vector2 Vector2(4, 4) The size of each bullet.
bullet_separation int 4 The separation between each bullet.
bullet_margin int 0 The separation between each bullet.
bullet_style StyleBox The style of active bullet.
bullet_inactive_style StyleBox The style of inactive bullet.
bullet_hover StyleBox The style of hovered active bullet.
bullet_inactive_hover StyleBox The style of hovered inactive bullet.
keyboard bool true Enables navigation through items using keyboard or controller.
keyboard_page_up_down bool true When enabled it will enable keyboard navigation by Page Up and Page Down keys.
keyboard_input_handled bool true Stops the input from propagating further down the SceneTree. If true then does not allow scrolling in ScrollContainer.
keyboard_release_on_edges bool false Set to true and will release input event and allow page left/right when on edge positions (in the beginning or in the end).
keyboard_allow_echo bool false Set to true to allow echo event.
keyboard_threshold_strength float 0.5 Minimum input strength to trigger item change. See more: method Input.get_action_strength.
keyboard_next_action_name String ui_right Action name for next item.
keyboard_prev_action_name String ui_left Action name for previous item.
mousewheel bool false Enables navigation through items using mouse wheel. By default, moving the mouse down selects the previous item, and moving the mouse up selects the next item.
mousewheel_invert bool false Set to true to invert spining direction.
mousewheel_focus bool true Will spining with the mouse wheel only in focus work.
mousewheel_input_handled bool true Stops the input from propagating further down the SceneTree. If true then does not allow scrolling in ScrollContainer.
mousewheel_release_on_edges bool false Set to true and will release mousewheel event and allow page scrolling when on edge positions (in the beginning or in the end).
mousewheel_events_target MousewheelTargets ALL Node containing the element of the container that accepts mouse wheel events. By default it is SpinButton.

Methods

After we initialize we have its initialized instance in variable with helpful methods:

Name Return Description
next_step() void Increases the value by step.
prev_step() void Decreases the value by step.

Theme Properties

SpinButton comes with some theme properties that you apply for styling.

See Theme Module


Signals

Name Description
value_changed(value: float) Emitted when the value changed.
edged(start: bool, end: bool) Emitted when the value edges are reached.

Enumerations

enum ValuePlacement:

Name Value Description
LEFT 0 Place the value label on the left.
RIGHT 1 Place the value label on the right.
TOP 2 Place the value label on the top.
BOTTOM 3 Place the value label on the bottom.
CENTER 4 Place the value label in the center.