Button

English

Buttonはユーザーのクリックを受けて処理を実行するコントロールです。

表示例

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

実行例

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

使い方

  • クリックはon_clickedで処理します。
  • 共通のtooltip、enable、disableも利用できます。

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