Combobox

English

Comboboxは固定された一覧から1項目を選択するコントロールです。

表示例

Combobox on Ubuntu
Ubuntu
Combobox on Windows
Windows
Combobox on macOS
macOS

実行例

require "uing"

UIng.init

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

combobox = UIng::Combobox.new(["Item 1", "Item 2", "Item 3"])
combobox.selected = 0
combobox.on_selected do |idx|
  window.msg_box("Combobox Changed", "Selected index: #{idx}")
end

window.child = combobox
window.show

UIng.main
UIng.uninit

使い方

  • 選択位置は0始まりのselectedとselected=で扱います。
  • 項目の追加、挿入、削除、全削除ができます。

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