Separator

English

Separatorは水平または垂直のネイティブ区切り線を描画します。単独では区切る対象がないため、Labelなどのコントロールを含むBox内で使います。実行例では両方の向きを示します。

表示例

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

実行例

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

使い方

  • :horizontalまたは:verticalを指定します。型付きのUIng::Orientationも使用できます。
  • 垂直線は水平Box、水平線は垂直Boxの中に配置します。
  • 区切り線の前後にLabelなどを配置して、関連するコントロールのまとまりを視覚的に分けます。

APIリファレンス · Galleryソース