2
# listbox widget demo 'sayings' (called by 'widget')
5
# toplevel widget ��¸�ߤ���к������
6
if defined?($sayings_demo) && $sayings_demo
11
# demo �Ѥ� toplevel widget ������
12
$sayings_demo = TkToplevel.new {|w|
13
title("Listbox Demonstration (well-known sayings)")
19
msg = TkLabel.new($sayings_demo) {
23
text "���Υꥹ�ȥܥå����ˤϤ��������ʳʸ������äƤ��ޤ����ꥹ�Ȥ������뤵����Τϥ���������С��Ǥ�Ǥ��ޤ������ꥹ�ȥܥå�������ǥޥ����Υܥ���2(��ܥ���)�����ޤޥɥ�å����Ƥ�Ǥ��ޤ���"
25
msg.pack('side'=>'top')
28
TkFrame.new($sayings_demo) {|frame|
33
tmppath = $sayings_demo
37
}.pack('side'=>'left', 'expand'=>'yes')
41
command proc{showCode 'sayings'}
42
}.pack('side'=>'left', 'expand'=>'yes')
44
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
48
TkFrame.new($sayings_demo, 'borderwidth'=>10) {|w|
49
sv = TkScrollbar.new(w)
50
sh = TkScrollbar.new(w, 'orient'=>'horizontal')
51
sayings_lbox = TkListbox.new(w) {
55
yscrollcommand proc{|first,last| sv.set first,last}
56
xscrollcommand proc{|first,last| sh.set first,last}
58
sv.command(proc{|*args| sayings_lbox.yview(*args)})
59
sh.command(proc{|*args| sayings_lbox.xview(*args)})
61
if $tk_version =~ /^4\.[01]/
62
sv.pack('side'=>'right', 'fill'=>'y')
63
sh.pack('side'=>'bottom', 'fill'=>'x')
64
sayings_lbox.pack('expand'=>'yes', 'fill'=>'y')
67
sayings_lbox.grid('row'=>0, 'column'=>0,
68
'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
69
sv.grid('row'=>0, 'column'=>1,
70
'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
71
sh.grid('row'=>1, 'column'=>0,
72
'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
73
TkGrid.rowconfigure(w, 0, 'weight'=>1, 'minsize'=>0)
74
TkGrid.columnconfigure(w, 0, 'weight'=>1, 'minsize'=>0)
77
}.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'y')
79
sayings_lbox.insert(0,
80
"Waste not, want not",
81
"Early to bed and early to rise makes a man healthy, wealthy, and wise",
82
"Ask not what your country can do for you, ask what you can do for your country",
85
"A picture is worth a thousand words",
86
"User interfaces are hard to build",
87
"Thou shalt not steal",
88
"A penny for your thoughts",
89
"Fool me once, shame on you; fool me twice, shame on me",
90
"Every cloud has a silver lining",
91
"Where there's smoke there's fire",
92
"It takes one to know one",
93
"Curiosity killed the cat",
94
"Take this job and shove it",
95
"Up a creek without a paddle",
96
"I'm mad as hell and I'm not going to take it any more",
97
"An apple a day keeps the doctor away",
98
"Don't look a gift horse in the mouth"