Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main > by-pkgid > e2a5fef11a7f55d2dc803b8b7498c8e5 > files > 689

ruby-tcltk-1.8.5-31.el5_9.x86_64.rpm

#!/usr/bin/env ruby
require 'tk'
require 'tkextlib/iwidgets'

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

slb = Tk::Iwidgets::Scrolledlistbox.new(:selectmode=>:single, 
                                        :vscrollmode=>:static,
                                        :hscrollmode=>:dynamic,
                                        :labeltext=>'List', 
                                        :selectioncommand=>proc{
                                          puts(slb.get_curselection)
                                        }, 
                                        :dblclickcommand=>proc{
                                          puts('Double Click')
                                          puts(slb.get_curselection)
                                        })
slb.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10)

slb.insert('end', *['Hello', 'Out There', 'World'])

Tk.mainloop