aboutsummaryrefslogtreecommitdiffstats
path: root/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb
blob: 8c0b68a22eaa664d03146f298cb47ec35e30d1bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env ruby
# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'

TkOption.add('*textBackground', 'white')

sb = Tk::Iwidgets::Selectionbox.new.pack(:padx=>10, :pady=>10,
                                         :fill=>:both, :expand=>true)

sb.insert_items('end', *['Hello', 'Out There', 'World'])

TkLabel.new(sb.child_site,
            :text=>'Child Site is Here').pack(:fill=>:x, :padx=>10, :pady=>10)

sb.insert_items(2, 'Cruel Cruel')

sb.selection_set(1)

Tk.mainloop