2003-07-31 16:52:40 -04:00
|
|
|
|
#
|
|
|
|
|
# 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>Υ<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EFBFBD>
|
|
|
|
|
TkFrame.new($radio_demo) {|frame|
|
|
|
|
|
TkButton.new(frame) {
|
2004-05-01 12:09:54 -04:00
|
|
|
|
#text 'λ<><CEBB>'
|
|
|
|
|
text '<27>Ĥ<EFBFBD><C4A4><EFBFBD>'
|
2003-07-31 16:52:40 -04:00
|
|
|
|
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')
|
|
|
|
|
}
|
|
|
|
|
|