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