3
# This demonstration script creates a toplevel window containing
4
# a paned window that separates two windows vertically.
6
# based on "Id: paned2.tcl,v 1.1 2002/02/22 14:07:01 dkf Exp"
8
if defined?($paned2_demo) && $paned2_demo
13
$paned2_demo = TkToplevel.new {|w|
14
title("Vertical Paned Window Demonstration")
19
TkLabel.new($paned2_demo,
20
:font=>$font, :wraplength=>'4i', :justify=>:left,
21
:text=><<EOL).pack(:side=>:top)
22
���Υ���������С��դ��Υ��������åȤ��֤��줿��ĤΥ�����ɥ��δ֤λ��ڤ��Ȥϡ���Ĥ��ΰ�줾��Υ�����ɥ��Τ����ʬ�䤹�뤿��Τ�ΤǤ������ܥ���ǻ��ڤ������ȡ�ʬ�䥵�����ѹ����������ǤϺ�ɽ���Ϥʤ��줺�����ꤵ�����Ȥ���ɽ������������ޤ����ޥ����ˤ����ڤ�������ɿ路�ƥ��������ѹ�����ɽ�����ʤ���褦�ˤ��������ϡ��ޥ���������ܥ����ȤäƤ���������
23
�⤷���ʤ����ȤäƤ��� Ruby �˥����Ƥ��� Tk �饤�֥�꤬ panedwindow ��������Ƥ��ʤ�
24
��硢���Υǥ�Ϥ��ޤ�ư���ʤ��Ϥ��Ǥ������ξ��ˤ� panedwindow ����������Ƥ���褦��
25
��꿷�����С������� Tk ���Ȥ߹�碌�ƻ
30
TkFrame.new($paned2_demo){|f|
31
pack(:side=>:bottom, :fill=>:x, :pady=>'2m')
33
TkButton.new(f, :text=>'�Ĥ���', :width=>15, :command=>proc{
36
}).pack(:side=>:left, :expand=>true)
38
TkButton.new(f, :text=>'�����ɻ���', :width=>15, :command=>proc{
40
}).pack(:side=>:left, :expand=>true)
43
paneList = TkVariable.new # define as normal variable (not array)
44
paneList.value = [ # ruby's array --> tcl's list
45
'Ruby/Tk �Υ��������åȰ���',
66
# Create the pane itself
67
TkPanedwindow.new($paned2_demo, :orient=>:vertical){|f|
68
pack(:side=>:top, :expand=>true, :fill=>:both, :pady=>2, :padx=>'2m')
70
add(TkFrame.new(f){|paned2_top|
71
TkListbox.new(paned2_top, :listvariable=>paneList) {
72
# Invert the first item to highlight it
73
itemconfigure(0, :background=>self.cget(:foreground),
74
:foreground=>self.cget(:background) )
75
yscrollbar(TkScrollbar.new(paned2_top).pack(:side=>:right,
77
pack(:fill=>:both, :expand=>true)
81
TkFrame.new(f, :height=>120) {|paned2_bottom|
82
# The bottom window is a text widget with scrollbar
83
paned2_xscr = TkScrollbar.new(paned2_bottom)
84
paned2_yscr = TkScrollbar.new(paned2_bottom)
85
paned2_text = TkText.new(paned2_bottom, :width=>30, :wrap=>:non) {
86
insert('1.0', '���������֤���Ƥ���Τϡ�' +
87
'�������̤Υƥ����ȥ��������åȤǤ���')
88
xscrollbar(paned2_xscr)
89
yscrollbar(paned2_yscr)
91
Tk.grid(paned2_text, paned2_yscr, :sticky=>'nsew')
92
Tk.grid(paned2_xscr, :sticky=>'nsew')
93
TkGrid.columnconfigure(paned2_bottom, 0, :weight=>1)
94
TkGrid.rowconfigure(paned2_bottom, 0, :weight=>1)