Slider

日本語

Slider selects an integer within a bounded range.

Appearance

Slider on Ubuntu
Ubuntu
Slider on Windows
Windows
Slider on macOS
macOS

Runnable example

require "uing"

UIng.init

window = UIng::Window.new("Slider Example", 320, 120, margined: true)
window.on_closing do
  UIng.quit
  true
end

value_label = UIng::Label.new("Value: 42")

slider = UIng::Slider.new(0, 100, 42)
slider.has_tool_tip = true
slider.on_changed do |v|
  value_label.text = "Value: #{v}"
end

box = UIng::Box.new(:vertical, padded: true)
box.append(value_label)
box.append(slider)

window.child = box
window.show

UIng.main
UIng.uninit

Usage notes

  • Use on_changed for live updates and on_released after dragging ends.
  • has_tool_tip controls the native value tooltip.

API reference · Gallery source