diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-08-02 05:04:30 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-08-02 05:04:30 +0000 |
commit | 4c3328f5476f54c84b1f048eed075e6edf5e5b1d (patch) | |
tree | 92b661314bdfd045882e365e3e43b77f57244725 /ext/tk/sample/demos-jp/rolodex-j | |
parent | d7bdf5df56f337d8ca1152598ff138703896c54b (diff) |
* (bug fix) TkEntry#delete
* (bug fix) some widget demos
* support <TkVariable object> == <Symbol>
( "coerce TkVariable" add to the TODO list :-) )
* freeze some object for security reason
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/demos-jp/rolodex-j')
-rw-r--r-- | ext/tk/sample/demos-jp/rolodex-j | 78 |
1 files changed, 33 insertions, 45 deletions
diff --git a/ext/tk/sample/demos-jp/rolodex-j b/ext/tk/sample/demos-jp/rolodex-j index 170f7bb96b..1c482aafb2 100644 --- a/ext/tk/sample/demos-jp/rolodex-j +++ b/ext/tk/sample/demos-jp/rolodex-j @@ -1,21 +1,14 @@ -#!/usr/local/bin/ruby +#!/usr/bin/env ruby # # rolodex -- # ���Υ�����ץȤ� Tom LaStrange �� rolodex �ΰ����Ǥ��� # # Copyright (C) 1998 by Takaaki Tateishi <[email protected]> -# Time-stamp: "98/07/20 12:00:36 ttate" +# Time-stamp: "03/08/02 14:01:54 nagai" # require "tk" - -# UTF8�ؤ��Ѵ���Ԥʤ��� - -$encoding = "euc-jp" -def j(str) - Tk.toUTF8(str,$encoding) -end - +Tk.encoding = "euc-jp" def show_help(topic,x=0,y=0) if( topic.is_a?(TkWindow) ) @@ -33,17 +26,17 @@ def show_help(topic,x=0,y=0) msg = "���Υȥԥå��ˤĤ��ƤΥإ�פϤޤ����ѤǤ��ޤ���" end TkDialog.new("title"=>"Rolodex Help", - "message"=>j("��#{topic}��\n\n#{msg}"), + "message"=>"��#{topic}��\n\n#{msg}", "default_button"=>0, "buttons"=>["OK"]) end def fillCard clearAction - $root.frame.entry[1].insert(0,j("Ω�� ����")) - $root.frame.entry[2].insert(0,j("923-1292 ���")) - $root.frame.entry[3].insert(0,j("ä��Į ���� 1-1")) - $root.frame.entry[4].insert(0,j("��Φ��ü�ʳص�����ر����")) + $root.frame.entry[1].insert(0, "Ω�� ����") + $root.frame.entry[2].insert(0, "923-1292 ���") + $root.frame.entry[3].insert(0, "ä��Į ���� 1-1") + $root.frame.entry[4].insert(0, "��Φ��ü�ʳص�����ر����") $root.frame.entry[5].insert(0,"private") $root.frame.entry[6].insert(0,"***-***-****") $root.frame.entry[7].insert(0,"***-***-****") @@ -53,7 +46,7 @@ def addAction for i in 1..7 STDERR.print format("%-12s %s\n", RolodexFrame::LABEL[i], - Tk.fromUTF8($root.frame.entry[i].value,$encoding)) + $root.frame.entry[i].value) end end @@ -65,7 +58,7 @@ end def fileAction TkDialog.new("title"=>"File Selection", - "message"=>j("����ϥե�������������������Υ��ߡ��Ǥ���\n"), + "message"=>"����ϥե�������������������Υ��ߡ��Ǥ���\n", "default_button"=>0, "buttons"=>["OK"]) STDERR.print "dummy file name\n" @@ -73,9 +66,9 @@ end def deleteAction result = TkDialog.new("title"=>"Confirm Action", - "message"=>j("��������Ǥ�����"), + "message"=>"��������Ǥ�����", "default_button"=>0, - "buttons"=>[j("�����")]) + "buttons"=>["�����"]) if( result.value == 0 ) clearAction end @@ -90,7 +83,6 @@ class RolodexFrame < TkFrame def initialize(parent=nil,keys=nil) super(parent,keys) self["relief"] = "flat" - @i = [] @label = [] @entry = [] @@ -100,7 +92,7 @@ class RolodexFrame < TkFrame "pady"=>2, "anchor"=>"e") @label[i] = TkLabel.new(@i[i], - "text"=>j(LABEL[i]), + "text"=>LABEL[i], "anchor"=>"e") @entry[i] = TkEntry.new(@i[i], "width"=>30, @@ -116,14 +108,10 @@ class RolodexButtons < TkFrame def initialize(parent,keys=nil) super(parent,keys) - @clear = TkButton.new(self, - "text" => j("���ꥢ��")) - @add = TkButton.new(self, - "text" => j("�ɲ�")) - @search = TkButton.new(self, - "text" => j("����")) - @delete = TkButton.new(self, - "text" => j("�õ�")) + @clear = TkButton.new(self,"text" => "���ꥢ��") + @add = TkButton.new(self, "text" => "�ɲ�") + @search = TkButton.new(self, "text" => "����") + @delete = TkButton.new(self, "text" => "�õ�") for w in [@clear,@add,@search,@delete] w.pack("side"=>"left", "padx"=>2) end @@ -139,42 +127,42 @@ class RolodexMenuFrame < TkFrame "borderwidth"=>1) @file = TkMenubutton.new(self, - "text"=>j("�ե�����"), + "text"=> "�ե�����", "underline"=>0) @file_menu = TkMenu.new(@file) @file_menu.add("command", - "label" => j("�ɤ߹��� ..."), + "label" => "�ɤ߹��� ...", "command" => proc{fileAction}, "underline" => 0) @file_menu.add("command", - "label" => j("��λ"), + "label" => "��λ", "command" => proc{$root.destroy}, "underline" => 0) @file.menu(@file_menu) @file.pack("side"=>"left") @help = TkMenubutton.new(self, - "text"=>j("�إ��"), + "text"=> "�إ��", "underline"=>0) @help_menu = TkMenu.new(@help) @help_menu.add("command", - "label"=>j("����ƥ����ȤˤĤ���"), + "label"=> "����ƥ����ȤˤĤ���", "command"=>proc{show_help("����ƥ�����")}, "underline"=>3) @help_menu.add("command", - "label"=>j("�إ�פˤĤ���"), + "label"=> "�إ�פˤĤ���", "command"=>proc{show_help("�إ��")}, "underline"=>3) @help_menu.add("command", - "label"=>j("������ɥ��ˤĤ���"), + "label"=> "������ɥ��ˤĤ���", "command"=>proc{show_help("������ɥ�")}, "underline"=>3) @help_menu.add("command", - "label"=>j("�������ˤĤ���"), + "label"=> "�������ˤĤ���", "command"=>proc{show_help("�������")}, "underline"=>3) @help_menu.add("command", - "label"=>j("�С���������"), + "label"=> "�С���������", "command"=>proc{show_help("�С���������")}, "underline"=>3) @help.menu(@help_menu) @@ -185,8 +173,8 @@ end class Rolodex < TkRoot attr_reader :frame, :buttons, :menu - def initialize - super + def initialize(*args) + super(*args) @frame = RolodexFrame.new(self) @frame.pack("side"=>"top", "fill"=>"y", @@ -209,16 +197,16 @@ $root.buttons.add.configure("command"=>proc{addAction}) $root.buttons.clear.configure("command"=>proc{clearAction}) $root.buttons.search.configure("command"=>proc{addAction; fillCard}) -$root.buttons.clear.configure("text"=>j("���ꥢ�� Ctrl+C")) +$root.buttons.clear.configure("text"=> "���ꥢ�� Ctrl+C") $root.bind("Control-c",proc{clearAction}) -$root.buttons.add.configure("text"=>j("�ɲ� Ctrl+A")) +$root.buttons.add.configure("text"=> "�ɲ� Ctrl+A") $root.bind("Control-a",proc{addAction}) -$root.buttons.search.configure("text"=>j("���� Ctrl+S")) +$root.buttons.search.configure("text"=> "���� Ctrl+S") $root.bind("Control-s",proc{addAction; fillCard}) -$root.buttons.delete.configure("text"=>j("�õ� Ctrl+D")) +$root.buttons.delete.configure("text"=> "�õ� Ctrl+D") $root.bind("Control-d",proc{deleteAction}) $root.menu.file_menu.entryconfigure(1, "accel"=>"Ctrl+F") @@ -305,7 +293,7 @@ Ctrl+S: ���� EOF $helpTopics["�С���������"] = <<EOF -�С������� 1.0 �Ǥ��� +�С������� 1.0.1j �Ǥ��� EOF Tk.mainloop |