OSDN Git Service

ruby-1.9.1-rc1
[splhack/AndroidRuby.git] / lib / ruby-1.9.1-rc1 / ext / tk / sample / tkextlib / iwidgets / sample / fileselectiondialog.rb
1 #!/usr/bin/env ruby
2 require 'tk'
3 require 'tkextlib/iwidgets'
4
5 mainloop = Thread.new{Tk.mainloop}
6
7 #
8 # Non-modal example
9 #
10 nmfsd = Tk::Iwidgets::Fileselectiondialog.new(:title=>'Non-Modal')
11 nmfsd.buttonconfigure('OK', :command=>proc{
12                         puts "You selected #{nmfsd.get}"
13                         nmfsd.deactivate
14                       })
15 nmfsd.activate
16
17 #
18 # Modal example
19 #
20 mfsd = Tk::Iwidgets::Fileselectiondialog.new(:modality=>:application)
21 mfsd.center
22 if TkComm.bool(mfsd.activate)
23   puts "You selected #{mfsd.get}"
24 else
25   puts "You cancelled the dialog"
26 end
27
28 mainloop.join