Checkbox

日本語

Checkbox represents an independent on/off choice.

Appearance

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

Runnable example

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

Usage notes

  • Read the state with checked? and set it with checked=.
  • on_toggled receives the new Boolean state.

API reference · Gallery source