1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/tk/sample/demos-jp/spin.rb

68 lines
2.2 KiB
Ruby
Raw Normal View History

# spin.rb --
#
# This demonstration script creates several spinbox widgets.
#
# based on Tcl/Tk8.4.4 widget demos
if defined?($spin_demo) && $spin_demo
$spin_demo.destroy
$spin_demo = nil
end
$spin_demo = TkToplevel.new {|w|
title("Spinbox Demonstration")
iconname("spin")
positionWindow(w)
}
TkLabel.new($spin_demo,
:font=>$font, :wraplength=>'5i', :justify=>:left,
:text=><<EOL).pack(:side=>:top)
<EFBFBD><EFBFBD><EFBFBD>ˤϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Υ<EFBFBD><EFBFBD>ԥ<EFBFBD><EFBFBD>ܥå<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD>\
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򤷤<EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϥ<EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><EFBFBD>Ǥ<EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD>
<EFBFBD>Խ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><EFBFBD>Ƥϡ<EFBFBD>Emacs <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¿<EFBFBD><EFBFBD><EFBFBD>˲ä<EFBFBD><EFBFBD>ơ<EFBFBD><EFBFBD><EFBF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><EFBFBD><EFBFBD>Ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Tk
<EFBFBD><EFBFBD><EFBFBD>Ȥ߹<EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><EFBFBD>ˤ<EFBFBD><EFBFBD>Ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
EOL
TkFrame.new($spin_demo){|f|
pack(:side=>:bottom, :fill=>:x, :pady=>'2m')
TkButton.new(f, :text=>'<27>Ĥ<EFBFBD><C4A4><EFBFBD>', :width=>15, :command=>proc{
$spin_demo.destroy
$spin_demo = nil
}).pack(:side=>:left, :expand=>true)
TkButton.new(f, :text=>'<27><><EFBFBD><EFBFBD><EFBFBD>ɻ<EFBFBD><C9BB><EFBFBD>', :width=>15, :command=>proc{
showCode 'spin'
}).pack(:side=>:left, :expand=>true)
}
australianCities = [
'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide',
'Brisbane', 'Hobart', 'Darwin', 'Alice Springs'
]
[
TkSpinbox.new($spin_demo, :from=>1, :to=>10, :width=>10, :validate=>:key,
:validatecommand=>[
proc{|s| s == '' || /^[+-]?\d+$/ =~ s }, '%P'
]),
TkSpinbox.new($spin_demo, :from=>0, :to=>3, :increment=>0.5,
:format=>'%05.2f', :width=>10),
TkSpinbox.new($spin_demo, :values=>australianCities, :width=>10)
].each{|sbox| sbox.pack(:side=>:top, :pady=>5, :padx=>10)}