mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
71 lines
1.9 KiB
Ruby
71 lines
1.9 KiB
Ruby
|
#
|
|||
|
# listbox widget demo 'states' (called by 'widget')
|
|||
|
#
|
|||
|
|
|||
|
# toplevel widget <20><>¸<EFBFBD>ߤ<EFBFBD><DFA4><EFBFBD><EFBFBD>к<EFBFBD><D0BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if defined?($states_demo) && $states_demo
|
|||
|
$states_demo.destroy
|
|||
|
$states_demo = nil
|
|||
|
end
|
|||
|
|
|||
|
# demo <20>Ѥ<EFBFBD> toplevel widget <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
$states_demo = TkToplevel.new {|w|
|
|||
|
title("Listbox Demonstration (states)")
|
|||
|
iconname("states")
|
|||
|
positionWindow(w)
|
|||
|
}
|
|||
|
|
|||
|
# label <20><><EFBFBD><EFBFBD>
|
|||
|
msg = TkLabel.new($states_demo) {
|
|||
|
font $font
|
|||
|
wraplength '4i'
|
|||
|
justify 'left'
|
|||
|
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><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>2(<28><><EFBFBD>ܥ<EFBFBD><DCA5><EFBFBD>)<29><EFBFBD><F2B2A1A4><EFBFBD><EFBFBD>ޤޥɥ<DEA5><C9A5>å<EFBFBD><C3A5><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>Ǥ<EFBFBD><C7A4>ޤ<EFBFBD><DEA4><EFBFBD>"
|
|||
|
}
|
|||
|
msg.pack('side'=>'top')
|
|||
|
|
|||
|
# frame <20><><EFBFBD><EFBFBD>
|
|||
|
TkFrame.new($states_demo) {|frame|
|
|||
|
TkButton.new(frame) {
|
|||
|
text 'λ<><CEBB>'
|
|||
|
command proc{
|
|||
|
tmppath = $states_demo
|
|||
|
$states_demo = nil
|
|||
|
tmppath.destroy
|
|||
|
}
|
|||
|
}.pack('side'=>'left', 'expand'=>'yes')
|
|||
|
|
|||
|
TkButton.new(frame) {
|
|||
|
text '<27><><EFBFBD><EFBFBD><EFBFBD>ɻ<EFBFBD><C9BB><EFBFBD>'
|
|||
|
command proc{showCode 'states'}
|
|||
|
}.pack('side'=>'left', 'expand'=>'yes')
|
|||
|
|
|||
|
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
|
|||
|
|
|||
|
# frame <20><><EFBFBD><EFBFBD>
|
|||
|
states_lbox = nil
|
|||
|
TkFrame.new($states_demo, 'borderwidth'=>'.5c') {|w|
|
|||
|
s = TkScrollbar.new(w)
|
|||
|
states_lbox = TkListbox.new(w) {
|
|||
|
setgrid 1
|
|||
|
height 12
|
|||
|
yscrollcommand proc{|first,last| s.set first,last}
|
|||
|
}
|
|||
|
s.command(proc{|*args| states_lbox.yview(*args)})
|
|||
|
s.pack('side'=>'right', 'fill'=>'y')
|
|||
|
states_lbox.pack('side'=>'left', 'expand'=>1, 'fill'=>'both')
|
|||
|
}.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'y')
|
|||
|
|
|||
|
ins_data = [
|
|||
|
'<27><><EFBFBD><EFBFBD>','<27>Ŀ<EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><>ɲ',
|
|||
|
'<27><>ʬ','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
'<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>',
|
|||
|
'<27><><EFBFBD><EFBFBD>','<27>Ų<EFBFBD>','<27>纬','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>',
|
|||
|
'Ļ<><C4BB>','<27>ٻ<EFBFBD>','Ĺ<><C4B9>','Ĺ<><C4B9>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','ʼ<><CABC>',
|
|||
|
'<27><><EFBFBD><EFBFBD>','ʡ<><CAA1>','ʡ<><CAA1>','ʡ<><CAA1>','<27>̳<EFBFBD>ƻ','<27><><EFBFBD><EFBFBD>','<27>ܾ<EFBFBD>',
|
|||
|
'<27>ܺ<EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD>','<27>²λ<C2B2>'
|
|||
|
]
|
|||
|
|
|||
|
states_lbox.insert(0, *ins_data)
|
|||
|
|