Class reference
Slider
Inherits Range
Abstract base class for sliders.
Description
Abstract base class for sliders, used to adjust a value by moving a grabber along a horizontal or vertical axis. Sliders are Range-based controls.
Properties
bool editable = true
bool editable = trueIf true, the slider can be interacted with. If false, the value can be changed only by code.
int focus_mode = 2
int focus_mode = 2bool scrollable = true
bool scrollable = trueIf true, the value can be changed using the mouse wheel.
float step = 1.0
float step = 1.0int tick_count = 0
int tick_count = 0Number of ticks displayed on the slider, including border ticks. Ticks are uniformly-distributed value markers.
bool ticks_on_borders = false
bool ticks_on_borders = falseIf true, the slider will display ticks for minimum and maximum values.
int ticks_position = 0
int ticks_position = 0Sets the position of the ticks. See TickPosition for details.
Signals
drag_ended(bool value_changed)
bool value_changed)Emitted when the grabber stops being dragged. If value_changed is true, Range.value is different from the value when the dragging was started.
drag_started()
Emitted when the grabber starts being dragged. This is emitted before the corresponding Range.value_changed signal.
Constants
TICK_POSITION_BOTTOM_RIGHT = 0
Places the ticks at the bottom of the HSlider, or right of the VSlider.
TICK_POSITION_TOP_LEFT = 1
Places the ticks at the top of the HSlider, or left of the VSlider.
TICK_POSITION_BOTH = 2
Places the ticks at the both sides of the slider.
TICK_POSITION_CENTER = 3
Places the ticks at the center of the slider.
Theme properties
int center_grabber = 0
int center_grabber = 0Boolean constant. If 1, the grabber texture size will be ignored and it will fit within slider's bounds based only on its center position.
int grabber_offset = 0
int grabber_offset = 0Vertical or horizontal offset of the grabber.
int tick_offset = 0
int tick_offset = 0Vertical or horizontal offset of the ticks. The offset is reversed for top or left ticks.
Texture2D grabber
Texture2D grabberThe texture for the grabber (the draggable element).
Texture2D grabber_disabled
Texture2D grabber_disabledThe texture for the grabber when it's disabled.
Texture2D grabber_highlight
Texture2D grabber_highlightThe texture for the grabber when it's focused.
Texture2D tick
Texture2D tickThe texture for the ticks, visible when Slider.tick_count is greater than 0.
StyleBox grabber_area
StyleBox grabber_areaThe background of the area to the left or bottom of the grabber.
StyleBox grabber_area_highlight
StyleBox grabber_area_highlightThe background of the area to the left or bottom of the grabber that displays when it's being hovered or focused.
StyleBox slider
StyleBox sliderThe background for the whole slider. Affects the height or width of the grabber_area.