Button

日本語

Button performs an action when the user clicks it.

Appearance

Button on Ubuntu
Ubuntu
Button on Windows
Windows
Button on macOS
macOS

Runnable example

require "uing"

UIng.init

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

button = UIng::Button.new("Button") do
  on_clicked do
    window.msg_box("Information", "You clicked the button")
  end
end
button.tooltip = "Click to show a message"

window.child = button
window.show

UIng.main
UIng.uninit

Usage notes

  • Handle clicks with on_clicked.
  • The inherited tooltip, enable, and disable operations are available.

API reference · Gallery source