blob: 25e0e64e9a3c36eea4671aec7364bb028405a768 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# -*- coding: euc-jp -*-
#
# text (basic facilities) widget demo (called by 'widget')
#
# toplevel widget ��¸�ߤ���к������
if defined?($text_demo) && $text_demo
$text_demo.destroy
$text_demo = nil
end
# demo �Ѥ� toplevel widget ������
$text_demo = TkToplevel.new {|w|
title("Text Demonstration - Basic Facilities")
iconname("text")
positionWindow(w)
}
# version check
if ((Tk::TK_VERSION.split('.').collect{|n| n.to_i} <=> [8,4]) < 0)
undo_support = false
else
undo_support = true
end
# frame ����
TkFrame.new($text_demo) {|frame|
TkButton.new(frame) {
#text '�'
text '�Ĥ���'
command proc{
tmppath = $text_demo
$text_demo = nil
tmppath.destroy
}
}.pack('side'=>'left', 'expand'=>'yes')
TkButton.new(frame) {
text '�����ɻ���'
command proc{showCode 'text'}
}.pack('side'=>'left', 'expand'=>'yes')
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
# text ����
TkText.new($text_demo){|t|
# ����
relief 'sunken'
bd 2
setgrid 1
height 30
TkScrollbar.new($text_demo) {|s|
pack('side'=>'right', 'fill'=>'y')
command proc{|*args| t.yview(*args)}
t.yscrollcommand proc{|first,last| s.set first,last}
}
pack('expand'=>'yes', 'fill'=>'both')
# �ƥ���������
insert('0.0', <<EOT)
���Υ�����ɥ��ϥƥ����� widget �Ǥ���1�Ԥޤ��Ϥ���ʾ�Υƥ����Ȥ�ɽ
�����Խ����뤳�Ȥ��Ǥ��ޤ����ʲ��ϥƥ����� widget �ǤǤ������ˤĤ���
�ޤȤ��ΤǤ���
1. ���������롣����������С��ǥƥ����Ȥ�ɽ����ʬ��ư�������Ȥ��Ǥ��ޤ���
2. ������˥��ƥ����ȤΥ�����ɥ��ǥޥ����ܥ���2 (��ܥ����) ��
���ƾ岼�˥ɥ�å����Ƥ�����������������ȥƥ����Ȥ���®�ǥɥ�å����졢
���Ƥä�į��뤳�Ȥ��Ǥ��ޤ���
3. �ƥ����Ȥ��������ޥ����ܥ���1 (���ܥ���) �����������������
�Ȥ��Ƥ���ƥ����Ȥ����Ϥ��Ƥ������������Ϥ�����Τ� widget ������ޤ���
4. �������ϰϤ�ʸ��������ˤϥޥ����ܥ���1 �����ɥ�å���
�Ƥ������������٥ܥ����Υ�����顢���եȥ������ʤ���ܥ���1 ��
���Ȥ������ϰϤ�Ĵ�����Ǥ��ޤ�������������ϰϤκǸ��ޥ������������
�Ǥ�ᤤ���֤˥ꥻ�åȤ����ܥ����Υ�����˥ޥ�����ɥ�å����뤳�ȤǤ�
��������ϰϤ�Ĵ���Ǥ��ޤ������֥륯��å��ǥ�ɤޤ��ȥ�ץ륯���
���ǹ����Τ����뤳�Ȥ��Ǥ��ޤ���
5. �õ���ִ����ƥ����Ȥ�õ��ˤϡ��õ����ʸ�������ƥХå�
���ڡ������ǥ�ȥ��������Ϥ��Ƥ������������뤤�ϡ��������ƥ����Ȥ�
���Ϥ�������줿�ƥ����Ȥ��ִ�����ޤ���
6. ������ʬ�Υ��ԡ���������ʬ�Υ�����ɥ�����Τɤ����˥��ԡ�����
�ˤϡ��ޤ����ԡ��������������(�����ǡ����뤤���̤Υ��ץꥱ��������)
�����ܥ��� 2 ��å����ơ�������������ΰ��֤˥��ԡ����Ƥ���������
7. �Խ����ƥ����� widget �� Emacs �Υ����Х���ɤ˲ä���ɸ��Ū�ʤ� Motif
���Խ���ǽ�ݡ��Ȥ��Ƥ��ޤ����Хå����ڡ����ȥ���ȥ�����-H ������
��������κ�¦��ʸ���������ޤ����ǥ�ȥ����ȥ���ȥ�����-D ������
��������α�¦��ʸ���������ޤ���Meta-�Хå����ڡ������������������
��¦��ñ���������Meta-D ��������������κ�¦��ñ��������ޤ���
����ȥ�����-K �������������뤫������ޤǤ����������ΰ��֤˲���
�����ʤ��ä����ϡ����Ԥ������ޤ���#{
if undo_support
undo_text = "Control-z �ϺǸ�˹Ԥä��ѹ��μ��ä�(undo)��Ԥ���"
case $tk_platform['platform']
when "unix", "macintosh"
undo_text << "Control-Shift-z"
else # 'windows'
undo_text << "Control-y"
end
undo_text << "��undo�����ѹ��κ�Ŭ��(redo)��Ԥ��ޤ���"
else
""
end
}
8. ������ɥ��Υꥵ���������� widget �� "setGrid" ���ץ�����ˤ�
�Ƥ���ޤ��Τǡ�������ɥ���ꥵ����������ˤϹ⤵�����Ͼ��ʸ�����ʸ
�����������ܤˤʤ�ޤ����ޤ���������ɥ����������ˤ�Ĺ���Ԥ���ư
Ū���ޤ��֤��졢������Ƥ����Ƥ�������褦�ˤʤäƤ��ޤ���
EOT
set_insert('0.0')
}
|