Checkbox

English

Checkboxは独立したオン/オフの選択を表します。

表示例

Checkbox on Ubuntu
Ubuntu
Checkbox on Windows
Windows
Checkbox on macOS
macOS

実行例

require "uing"

UIng.init

window = UIng::Window.new("Checkbox Example", 300, 100, margined: true)
window.on_closing do
  UIng.quit
  true
end

checkbox = UIng::Checkbox.new("Check me")
checkbox.on_toggled do |checked|
  window.msg_box("Checkbox", "Checked: #{checked}")
end

window.child = checkbox
window.show

UIng.main
UIng.uninit

使い方

  • 状態はchecked?で読み、checked=で設定します。
  • on_toggledには変更後の真偽値が渡されます。

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