Sophie

Sophie

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

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

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

mainloop = Thread.new{Tk.mainloop}

#
# Non-modal example
#
nmfsd = Tk::Iwidgets::Extfileselectiondialog.new(:title=>'Non-Modal')
nmfsd.buttonconfigure('OK', :command=>proc{
                        puts "You selected #{nmfsd.get}"
                        nmfsd.deactivate
                      })
nmfsd.activate

#
# Modal example
#
mfsd = Tk::Iwidgets::Extfileselectiondialog.new(:modality=>:application)
mfsd.center
if TkComm.bool(mfsd.activate)
  puts "You selected #{mfsd.get}"
else
  puts "You cancelled the dialog"
end


mainloop.join