~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to ext/tk/sample/demos-jp/radio.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# radiobutton widget demo (called by 'widget')
 
3
#
 
4
 
 
5
# toplevel widget ��¸�ߤ���к������
 
6
if defined?($radio_demo) && $radio_demo
 
7
  $radio_demo.destroy 
 
8
  $radio_demo = nil
 
9
end
 
10
 
 
11
# demo �Ѥ� toplevel widget ������
 
12
$radio_demo = TkToplevel.new {|w|
 
13
  title("Radiobutton Demonstration")
 
14
  iconname("radio")
 
15
  positionWindow(w)
 
16
}
 
17
 
 
18
# label ����
 
19
msg = TkLabel.new($radio_demo) {
 
20
  font $font
 
21
  wraplength '4i'
 
22
  justify 'left'
 
23
  text "���ˤ�2�ĤΥ饸���ܥ��󥰥롼�פ�ɽ������Ƥ��ޤ����ܥ���򥯥�å�����ȡ����Υܥ�����������Υ��롼�פ�������򤵤�ޤ����ƥ��롼�פ��Ф��Ƥ��Υ��롼�פ���ΤɤΥܥ������򤵤�Ƥ��뤫�򼨤��ѿ���������Ƥ��Ƥ��ޤ������ߤ��ѿ����ͤ򸫤�ˤϡ��ѿ����ȡץܥ���򥯥�å����Ƥ���������"
 
24
}
 
25
msg.pack('side'=>'top')
 
26
 
 
27
# �ѿ�����
 
28
size = TkVariable.new
 
29
color = TkVariable.new
 
30
 
 
31
# frame ����
 
32
TkFrame.new($radio_demo) {|frame|
 
33
  TkButton.new(frame) {
 
34
    #text 'λ��'
 
35
    text '�Ĥ���'
 
36
    command proc{
 
37
      tmppath = $radio_demo
 
38
      $radio_demo = nil
 
39
      $showVarsWin[tmppath.path] = nil
 
40
      tmppath.destroy
 
41
    }
 
42
  }.pack('side'=>'left', 'expand'=>'yes')
 
43
 
 
44
  TkButton.new(frame) {
 
45
    text '�����ɻ���'
 
46
    command proc{showCode 'radio'}
 
47
  }.pack('side'=>'left', 'expand'=>'yes')
 
48
 
 
49
  TkButton.new(frame) {
 
50
    text '�ѿ�����'
 
51
    command proc{
 
52
      showVars($radio_demo, ['size', size], ['color', color])
 
53
    }
 
54
  }.pack('side'=>'left', 'expand'=>'yes')
 
55
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
 
56
 
 
57
# frame ����
 
58
f_left = TkFrame.new($radio_demo)
 
59
f_right = TkFrame.new($radio_demo)
 
60
f_left.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c')
 
61
f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c')
 
62
 
 
63
# radiobutton ����
 
64
[10, 12, 18, 24].each {|sz|
 
65
  TkRadioButton.new(f_left) {
 
66
    text "�ݥ���ȥ����� #{sz}"
 
67
    variable size
 
68
    relief 'flat'
 
69
    value sz
 
70
  }.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w')
 
71
}
 
72
 
 
73
['��', '��', '��', '��', '��', '��'].each {|col|
 
74
  TkRadioButton.new(f_right) {
 
75
    text col
 
76
    variable color
 
77
    relief 'flat'
 
78
    value col.downcase
 
79
  }.pack('side'=>'top', 'pady'=>2, 'anchor'=>'w')
 
80
}
 
81