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/radio.rb

81 lines
2 KiB
Ruby
Raw Normal View History

#
# radiobutton widget demo (called by 'widget')
#
# toplevel widget <20><>¸<EFBFBD>ߤ<EFBFBD><DFA4><EFBFBD><EFBFBD>к<EFBFBD><D0BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if defined?($radio_demo) && $radio_demo
$radio_demo.destroy
$radio_demo = nil
end
# demo <20>Ѥ<EFBFBD> toplevel widget <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$radio_demo = TkToplevel.new {|w|
title("Radiobutton Demonstration")
iconname("radio")
positionWindow(w)
}
# label <20><><EFBFBD><EFBFBD>
msg = TkLabel.new($radio_demo) {
font $font
wraplength '4i'
justify 'left'
text "<EFBFBD><EFBFBD><EFBFBD>ˤ<EFBFBD>2<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>Ф<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><EFBFBD>Ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
}
msg.pack('side'=>'top')
# <20>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>
size = TkVariable.new
color = TkVariable.new
# frame <20><><EFBFBD><EFBFBD>
TkFrame.new($radio_demo) {|frame|
TkButton.new(frame) {
text <><CEBB>'
command proc{
tmppath = $radio_demo
$radio_demo = nil
$showVarsWin[tmppath.path] = nil
tmppath.destroy
}
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
text '<27><><EFBFBD><EFBFBD><EFBFBD>ɻ<EFBFBD><C9BB><EFBFBD>'
command proc{showCode 'radio'}
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
text '<27>ѿ<EFBFBD><D1BF><EFBFBD><EFBFBD><EFBFBD>'
command proc{
showVars($radio_demo, ['size', size], ['color', color])
}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
# frame <20><><EFBFBD><EFBFBD>
f_left = TkFrame.new($radio_demo)
f_right = TkFrame.new($radio_demo)
f_left.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c')
f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c')
# radiobutton <20><><EFBFBD><EFBFBD>
[10, 12, 18, 24].each {|sz|
TkRadioButton.new(f_left) {
text "<EFBFBD>ݥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #{sz}"
variable size
relief 'flat'
value sz
}.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w')
}
['<27><>', '<27><>', '<27><>', '<27><>', '<27><>', '<27><>'].each {|col|
TkRadioButton.new(f_right) {
text col
variable color
relief 'flat'
value col.downcase
}.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w')
}