Godot - Slider - Inherits:Range

  1. English
  2. Godot 4.2
  3. Slider
Slider

Inherits:Range<Control<CanvasItem<Node<Object

Inherited By:HSlider, VSlider

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

FocusMode

focus_mode

2 (overrides Control)

bool

scrollable

true

float

step

1.0 (overrides Range)

int

tick_count

0

bool

ticks_on_borders

false

Theme Properties

int

center_grabber

0

int

grabber_offset

0

Texture2D

grabber

Texture2D

grabber_disabled

Texture2D

grabber_highlight

Texture2D

tick

StyleBox

grabber_area

StyleBox

grabber_area_highlight

StyleBox

slider

Signals

drag_ended ( bool value_changed )

Emitted when dragging stops. If value_changed is true, Range.value is different from the value when you started the dragging.

drag_started ( )

Emitted when dragging is started.

Property Descriptions

bool editable = true

  • void set_editable(bool value )
  • boolis_editable()

If true, the slider can be interacted with. If false, the value can be changed only by code.

bool scrollable = true

  • void set_scrollable(bool value )
  • boolis_scrollable()

If true, the value can be changed using the mouse wheel.

int tick_count = 0

  • void set_ticks(int value )
  • intget_ticks()

Number of ticks displayed on the slider, including border ticks. Ticks are uniformly-distributed value markers.

bool ticks_on_borders = false

  • void set_ticks_on_borders(bool value )
  • boolget_ticks_on_borders()

If true, the slider will display ticks for minimum and maximum values.

Theme Property Descriptions

int center_grabber = 0

Boolean 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

Vertical or horizontal offset of the grabber.

Texture2D grabber

The texture for the grabber (the draggable element).

Texture2D grabber_disabled

The texture for the grabber when it's disabled.

Texture2D grabber_highlight

The texture for the grabber when it's focused.

Texture2D tick

The texture for the ticks, visible when tick_count is greater than 0.

StyleBox grabber_area

The background of the area to the left or bottom of the grabber.

StyleBox grabber_area_highlight

The background of the area to the left or bottom of the grabber that displays when it's being hovered or focused.

StyleBox slider

The background for the whole slider. Affects the height or width of the grabber_area.

© 2014–present Juan Linietsky, Ariel Manzur and the Godot communityLicensed under the Creative Commons Attribution Unported License v3.0. https://docs.godotengine.org/en/4.2/classes/class_slider.html

  • First look at Godot's editor
  • Godot's design philosophy
  • Introduction to Godot
  • Learn to code with GDScript
  • Learning new features
  • Overview of Godot's key concepts
  • SliderJoint3D

Từ khóa » Hslider Godot