2003-07-31 16:52:40 -04:00
|
|
|
|
#
|
|
|
|
|
# menus widget demo (called by 'widget')
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# toplevel widget <20><>¸<EFBFBD>ߤ<EFBFBD><DFA4><EFBFBD><EFBFBD>к<EFBFBD><D0BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if defined?($menu_demo) && $menu_demo
|
|
|
|
|
$menu_demo.destroy
|
|
|
|
|
$menu_demo = nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# demo <20>Ѥ<EFBFBD> toplevel widget <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
$menu_demo = TkToplevel.new {|w|
|
|
|
|
|
title("File Selection Dialogs")
|
|
|
|
|
iconname("menu")
|
|
|
|
|
positionWindow(w)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# menu frame <20><><EFBFBD><EFBFBD>
|
|
|
|
|
$menu_frame = TkFrame.new($menu_demo, 'relief'=>'raised', 'bd'=>2)
|
|
|
|
|
$menu_frame.pack('side'=>'top', 'fill'=>'x')
|
|
|
|
|
|
|
|
|
|
# label <20><><EFBFBD><EFBFBD>
|
|
|
|
|
TkLabel.new($menu_demo,'font'=>$font,'wraplength'=>'4i','justify'=>'left') {
|
|
|
|
|
if $tk_platform['platform'] == 'macintosh'
|
|
|
|
|
text("<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><E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塼<CBA5><E5A1BC><EFBFBD><EFBFBD><EFBFBD>ꤹ<EFBFBD>뤳<EFBFBD>Ȥʤ<C8A4><CAA4>˼¹Ԥ<C2B9><D4A4>뤳<EFBFBD>Ȥ<EFBFBD><C8A4>Ǥ<EFBFBD><C7A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˥塼<CBA5><E5A1BC><EFBFBD><EFBFBD><EFBFBD>桢<EFBFBD>Ǹ<EFBFBD><C7B8>Τ<EFBFBD><CEA4>Τϡ<CEA4><CFA1><EFBFBD><EFBFBD>Υ<EFBFBD><CEA5>˥塼<CBA5>κǽ<CEBA><C7BD>ι<EFBFBD><CEB9>ܤ<EFBFBD><DCA4><EFBFBD><EFBFBD>뤳<F2A4B9A4>Ȥ<EFBFBD><C8A4><EFBFBD>Ω<EFBFBD><CEA9><EFBFBD><EFBFBD><EFBFBD>뤳<EFBFBD>Ȥ<EFBFBD><C8A4>Ǥ<EFBFBD><C7A4>ޤ<EFBFBD><DEA4><EFBFBD>")
|
|
|
|
|
end
|
|
|
|
|
}.pack('side'=>'top')
|
|
|
|
|
|
|
|
|
|
# frame <20><><EFBFBD><EFBFBD>
|
|
|
|
|
TkFrame.new($menu_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 = $menu_demo
|
|
|
|
|
$menu_demo = nil
|
|
|
|
|
tmppath.destroy
|
|
|
|
|
}
|
|
|
|
|
}.pack('side'=>'left', 'expand'=>'yes')
|
|
|
|
|
|
|
|
|
|
TkButton.new(frame) {
|
|
|
|
|
text '<27><><EFBFBD><EFBFBD><EFBFBD>ɻ<EFBFBD><C9BB><EFBFBD>'
|
|
|
|
|
command proc{showCode 'menu'}
|
|
|
|
|
}.pack('side'=>'left', 'expand'=>'yes')
|
|
|
|
|
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
|
|
|
|
|
|
|
|
|
|
# menu <20><><EFBFBD><EFBFBD>
|
|
|
|
|
TkMenubutton.new($menu_frame, 'text'=>'File', 'underline'=>0) {|m|
|
|
|
|
|
pack('side'=>'left')
|
|
|
|
|
TkMenu.new(m, 'tearoff'=>false) {|file_menu|
|
|
|
|
|
m.configure('menu'=>file_menu)
|
|
|
|
|
add('command', 'label'=>'<27><><EFBFBD><EFBFBD> ...', 'command'=>proc{fail '<27><><EFBFBD><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1>ǥ<EFBFBD><C7A5>Ǥ<EFBFBD><C7A4>Τ<EFBFBD>"<22><><EFBFBD><EFBFBD> ..."<22><><EFBFBD>Ф<EFBFBD><D0A4>륢<EFBFBD><EBA5A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>'})
|
|
|
|
|
add('command', 'label'=>'<27><><EFBFBD><EFBFBD>', 'command'=>proc{fail '<27><><EFBFBD><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1>ǥ<EFBFBD><C7A5>Ǥ<EFBFBD><C7A4>Τ<EFBFBD>"<22><><EFBFBD><EFBFBD>"<22><><EFBFBD>Ф<EFBFBD><D0A4>륢<EFBFBD><EBA5A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>'})
|
|
|
|
|
add('command', 'label'=>'<27><>¸', 'command'=>proc{fail '<27><><EFBFBD><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1>ǥ<EFBFBD><C7A5>Ǥ<EFBFBD><C7A4>Τ<EFBFBD>"<22><>¸"<22><><EFBFBD>Ф<EFBFBD><D0A4>륢<EFBFBD><EBA5A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>'})
|
|
|
|
|
add('command', 'label'=>'<27><>¸(<28><><EFBFBD><EFBFBD>) ...', 'command'=>proc{fail '<27><><EFBFBD><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1>ǥ<EFBFBD><C7A5>Ǥ<EFBFBD><C7A4>Τ<EFBFBD>"<22><>¸(<28><><EFBFBD><EFBFBD>) ..."<22><><EFBFBD>Ф<EFBFBD><D0A4>륢<EFBFBD><EBA5A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>'})
|
|
|
|
|
add('separator')
|
|
|
|
|
add('command', 'label'=>'<27>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ...', 'command'=>proc{fail '<27><><EFBFBD><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1>ǥ<EFBFBD><C7A5>Ǥ<EFBFBD><C7A4>Τ<EFBFBD>"<22>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ..."<22><><EFBFBD>Ф<EFBFBD><D0A4>륢<EFBFBD><EBA5A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>'})
|
|
|
|
|
add('command', 'label'=>'<27>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD> ...', 'command'=>proc{fail '<27><><EFBFBD><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1>ǥ<EFBFBD><C7A5>Ǥ<EFBFBD><C7A4>Τ<EFBFBD>"<22>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD> ..."<22><><EFBFBD>Ф<EFBFBD><D0A4>륢<EFBFBD><EBA5A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>'})
|
|
|
|
|
add('separator')
|
|
|
|
|
add('command', 'label'=>'<27><>λ', 'command'=>proc{$menu_demo.destroy})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if $tk_platform['platform'] == 'macintosh'
|
|
|
|
|
modifier = 'Command'
|
|
|
|
|
elsif $tk_platform['platform'] == 'windows'
|
|
|
|
|
modifier = 'Control'
|
|
|
|
|
else
|
|
|
|
|
modifier = 'Meta'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
TkMenubutton.new($menu_frame, 'text'=>'Basic', 'underline'=>0) {|m|
|
|
|
|
|
pack('side'=>'left')
|
|
|
|
|
TkMenu.new(m, 'tearoff'=>false) {|basic_menu|
|
|
|
|
|
m.configure('menu'=>basic_menu)
|
|
|
|
|
add('command', 'label'=>'<27><><EFBFBD>⤷<EFBFBD>ʤ<EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD>')
|
|
|
|
|
['A','B','C','D','E','F','G'].each{|c|
|
|
|
|
|
# add('command', 'label'=>"ʸ<><CAB8> \"#{c}\" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 'underline'=>4,
|
|
|
|
|
add('command', 'label'=>"Print letter \"#{c}\" (ʸ<><CAB8> \"#{c}\" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)",
|
2004-10-11 00:51:21 -04:00
|
|
|
|
'underline'=>14, 'accelerator'=>"Meta+#{c}",
|
|
|
|
|
'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}")
|
2003-07-31 16:52:40 -04:00
|
|
|
|
$menu_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m|
|
|
|
|
|
pack('side'=>'left')
|
|
|
|
|
TkMenu.new(m, 'tearoff'=>false) {|cascade_menu|
|
|
|
|
|
m.configure('menu'=>cascade_menu)
|
|
|
|
|
add('command', 'label'=>'Print hello(<28><><EFBFBD><EFBFBD><EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD>)',
|
2004-10-11 00:51:21 -04:00
|
|
|
|
'command'=>proc{print "Hello(<28><><EFBFBD><EFBFBD><EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD>)\n"},
|
|
|
|
|
'accelerator'=>"#{modifier}+H", 'underline'=>6)
|
2003-07-31 16:52:40 -04:00
|
|
|
|
$menu_demo.bind("#{modifier}-h", proc{print "Hello(<28><><EFBFBD><EFBFBD><EFBFBD>ˤ<EFBFBD><CBA4><EFBFBD>)\n"})
|
|
|
|
|
add('command', 'label'=>'Print goodbye(<28><><EFBFBD>褦<EFBFBD>ʤ<EFBFBD>)',
|
2004-10-11 00:51:21 -04:00
|
|
|
|
'command'=>proc{print "Goodbye(<28><><EFBFBD>褦<EFBFBD>ʤ<EFBFBD>)\n"},
|
|
|
|
|
'accelerator'=>"#{modifier}+G", 'underline'=>6)
|
2003-07-31 16:52:40 -04:00
|
|
|
|
$menu_demo.bind("#{modifier}-g", proc{print "Goodbye(<28><><EFBFBD>褦<EFBFBD>ʤ<EFBFBD>)\n"})
|
|
|
|
|
|
|
|
|
|
TkMenu.new(m, 'tearoff'=>false) {|cascade_check|
|
|
|
|
|
cascade_menu.add('cascade', 'label'=>'Check buttons(<28><><EFBFBD><EFBFBD><EFBFBD>å<EFBFBD><C3A5>ܥ<EFBFBD><DCA5><EFBFBD>)',
|
2004-10-11 00:51:21 -04:00
|
|
|
|
'menu'=>cascade_check, 'underline'=>0)
|
2003-07-31 16:52:40 -04:00
|
|
|
|
oil = TkVariable.new(0)
|
|
|
|
|
add('check', 'label'=>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', 'variable'=>oil)
|
|
|
|
|
trans = TkVariable.new(0)
|
|
|
|
|
add('check', 'label'=>'<27>ȥ<EFBFBD><C8A5>ߥå<DFA5><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', 'variable'=>trans)
|
|
|
|
|
brakes = TkVariable.new(0)
|
|
|
|
|
add('check', 'label'=>'<27>֥졼<D6A5><ECA1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', 'variable'=>brakes)
|
|
|
|
|
lights = TkVariable.new(0)
|
|
|
|
|
add('check', 'label'=>'<27>饤<EFBFBD><E9A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', 'variable'=>lights)
|
|
|
|
|
add('separator')
|
|
|
|
|
add('command', 'label'=>'<27><><EFBFBD>ߤ<EFBFBD><DFA4>ͤ<EFBFBD>ɽ<EFBFBD><C9BD>',
|
2004-10-11 00:51:21 -04:00
|
|
|
|
'command'=>proc{showVars($menu_demo,
|
|
|
|
|
['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', oil],
|
|
|
|
|
['<27>ȥ<EFBFBD><C8A5>ߥå<DFA5><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', trans],
|
|
|
|
|
['<27>֥졼<D6A5><ECA1BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', brakes],
|
|
|
|
|
['<27>饤<EFBFBD><E9A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', lights])} )
|
2003-07-31 16:52:40 -04:00
|
|
|
|
invoke 1
|
|
|
|
|
invoke 3
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TkMenu.new(m, 'tearoff'=>false) {|cascade_radio|
|
|
|
|
|
cascade_menu.add('cascade', 'label'=>'Radio buttons(<28>饸<EFBFBD><E9A5B8><EFBFBD>ܥ<EFBFBD><DCA5><EFBFBD>)',
|
2004-10-11 00:51:21 -04:00
|
|
|
|
'menu'=>cascade_radio, 'underline'=>0)
|
2003-07-31 16:52:40 -04:00
|
|
|
|
pointSize = TkVariable.new
|
|
|
|
|
add('radio', 'label'=>'10 <20>ݥ<EFBFBD><DDA5><EFBFBD><EFBFBD><EFBFBD>', 'variable'=>pointSize, 'value'=>10)
|
|
|
|
|
add('radio', 'label'=>'14 <20>ݥ<EFBFBD><DDA5><EFBFBD><EFBFBD><EFBFBD>', 'variable'=>pointSize, 'value'=>14)
|
|
|
|
|
add('radio', 'label'=>'18 <20>ݥ<EFBFBD><DDA5><EFBFBD><EFBFBD><EFBFBD>', 'variable'=>pointSize, 'value'=>18)
|
|
|
|
|
add('radio', 'label'=>'24 <20>ݥ<EFBFBD><DDA5><EFBFBD><EFBFBD><EFBFBD>', 'variable'=>pointSize, 'value'=>24)
|
|
|
|
|
add('radio', 'label'=>'32 <20>ݥ<EFBFBD><DDA5><EFBFBD><EFBFBD><EFBFBD>', 'variable'=>pointSize, 'value'=>32)
|
|
|
|
|
add('separator')
|
|
|
|
|
style = TkVariable.new
|
|
|
|
|
add('radio', 'label'=>'<27><><EFBFBD><EFBFBD><EFBFBD>ޥ<EFBFBD>', 'variable'=>style, 'value'=>'roman')
|
|
|
|
|
add('radio', 'label'=>'<27>ܡ<EFBFBD><DCA1><EFBFBD><EFBFBD><EFBFBD>', 'variable'=>style, 'value'=>'bold')
|
|
|
|
|
add('radio', 'label'=>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>å<EFBFBD>', 'variable'=>style, 'value'=>'italic')
|
|
|
|
|
add('separator')
|
|
|
|
|
add('command', 'label'=>'<27><><EFBFBD>ߤ<EFBFBD><DFA4>ͤ<EFBFBD>ɽ<EFBFBD><C9BD>',
|
2004-10-11 00:51:21 -04:00
|
|
|
|
'command'=>proc{showVars($menu_demo,
|
|
|
|
|
['<27>ݥ<EFBFBD><DDA5><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD>', pointSize],
|
|
|
|
|
['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', style])} )
|
2003-07-31 16:52:40 -04:00
|
|
|
|
invoke 1
|
|
|
|
|
invoke 7
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TkMenubutton.new($menu_frame, 'text'=>'Icons', 'underline'=>0) {|m|
|
|
|
|
|
pack('side'=>'left')
|
|
|
|
|
TkMenu.new(m, 'tearoff'=>false) {|icon_menu|
|
|
|
|
|
m.configure('menu'=>icon_menu)
|
|
|
|
|
add('command',
|
2004-10-11 00:51:21 -04:00
|
|
|
|
'bitmap'=>'@'+[$demo_dir,'..',
|
|
|
|
|
'images','pattern.xbm'].join(File::Separator),
|
|
|
|
|
'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry',
|
|
|
|
|
'text'=>'<27><><EFBFBD><EFBFBD><EFBFBD>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F2A4B7A4><EFBFBD><EFBFBD>˥塼<CBA5>ι<EFBFBD><CEB9>ܤϥƥ<CFA5><C6A5><EFBFBD><EFBFBD>ȤǤϤʤ<CFA4><CAA4>ӥåȥޥåפ<C3A5>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʳ<EFBFBD><CAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD>¾<EFBFBD>Υ<EFBFBD><CEA5>˥塼<CBA5><E5A1BC><EFBFBD>ܤ<EFBFBD><DCA4>Ѥ<EFBFBD><D1A4><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'bitmap'=>'', 'default'=>0,
|
|
|
|
|
'buttons'=>'λ<><CEBB>')} )
|
2003-07-31 16:52:40 -04:00
|
|
|
|
['info', 'questhead', 'error'].each{|icon|
|
|
|
|
|
add('command', 'bitmap'=>icon,
|
2004-10-11 00:51:21 -04:00
|
|
|
|
'command'=>proc{print "You invoked the #{icon} bitmap\n"})
|
2003-07-31 16:52:40 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TkMenubutton.new($menu_frame, 'text'=>'More', 'underline'=>0) {|m|
|
|
|
|
|
pack('side'=>'left')
|
|
|
|
|
TkMenu.new(m, 'tearoff'=>false) {|more_menu|
|
|
|
|
|
m.configure('menu'=>more_menu)
|
|
|
|
|
[ '<27><><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD>','<27>̤Υ<CCA4><CEA5><EFBFBD><EFBFBD>ȥ<EFBFBD>','<27><><EFBFBD>⤷<EFBFBD>ʤ<EFBFBD>','<27>ۤȤ<DBA4><C8A4>ɲ<EFBFBD><C9B2>⤷<EFBFBD>ʤ<EFBFBD>',
|
|
|
|
|
'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Τ<EFBFBD>' ].each{|i|
|
|
|
|
|
add('command', 'label'=>i,
|
2004-10-11 00:51:21 -04:00
|
|
|
|
'command'=>proc{print "You invoked \"#{i}\"\n"})
|
2003-07-31 16:52:40 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TkMenubutton.new($menu_frame, 'text'=>'Colors', 'underline'=>0) {|m|
|
|
|
|
|
pack('side'=>'left')
|
|
|
|
|
TkMenu.new(m) {|colors_menu|
|
|
|
|
|
m.configure('menu'=>colors_menu)
|
|
|
|
|
['red', 'orange', 'yellow', 'green', 'blue'].each{|c|
|
|
|
|
|
add('command', 'label'=>c, 'background'=>c,
|
2004-10-11 00:51:21 -04:00
|
|
|
|
'command'=>proc{print "You invoked \"#{c}\"\n"})
|
2003-07-31 16:52:40 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|