Separator

日本語

Separator draws a native horizontal or vertical divider. By itself it has nothing to divide, so use it in a Box with controls such as Labels. The runnable example shows both orientations.

Appearance

Separator on Ubuntu
Ubuntu
Separator on Windows
Windows
Separator on macOS
macOS

Runnable example

require "uing"

UIng.init

window = UIng::Window.new("Separator Example", 360, 160, margined: true)
window.on_closing do
  UIng.quit
  true
end

box = UIng::Box.new(:vertical, padded: true)
box.append(UIng::Label.new("Above the separator"), stretchy: false)
box.append(UIng::Separator.new(:horizontal), stretchy: false)

row = UIng::Box.new(:horizontal, padded: true)
row.append(UIng::Label.new("Left of the separator"))
row.append(UIng::Separator.new(:vertical), stretchy: false)
row.append(UIng::Label.new("Right of the separator"))
box.append(row)

window.child = box
window.show

UIng.main
UIng.uninit

Usage notes

  • Construct it with :horizontal or :vertical. The typed UIng::Orientation values are also accepted.
  • Place a vertical separator inside a horizontal Box and a horizontal separator inside a vertical Box.
  • Place Labels or other controls on either side to visually separate related groups.

API reference · Gallery source