[#8530] Enumerable and rand — Koretsugu Daigoro <tmmcross@...>

これつぐです。

21 messages 1999/12/05
[#8534] Re: Enumerable and rand — matz@... (Yukihiro Matsumoto) 1999/12/06

まつもと ゆきひろです

[#8581] Re: [ruby-list:19228] Ruby 1.4.3 — Katsuyuki Komatsu <komatsu@...>

小松です。

19 messages 1999/12/07
[#8592] Re: [ruby-list:19228] Ruby 1.4.3 — matz@... (Yukihiro Matsumoto) 1999/12/07

まつもと ゆきひろです

[#8645] urllib and httplib — TAKAHASHI Masayoshi <maki@...>

高橋征義です。

47 messages 1999/12/14
[#8646] Re: urllib and httplib — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/12/14

なひです.

[#8653] Re: urllib and httplib — matz@... (Yukihiro Matsumoto) 1999/12/14

まつもと ゆきひろです

[#8656] Re: urllib and httplib — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/12/15

なひです.

[#8659] Re: urllib and httplib — Wakou Aoyama <wakou@...> 1999/12/15

青山です。

[#8685] Re: urllib and httplib — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/12/21

なひです.

[#8687] Re: urllib and httplib — TAKAHASHI Masayoshi <maki@...> 1999/12/21

高橋征義です。

[#8690] Re: urllib and httplib — matz@... (Yukihiro Matsumoto) 1999/12/21

まつもと ゆきひろです

[#8717] Re: urllib and httplib — TAKAHASHI Masayoshi <maki@...> 1999/12/24

高橋征義です。

[#8963] Re: urllib and httplib — "NAKAMURA, Hiroshi" <nakahiro@...> 2000/01/19

なひです.

[#8650] [PATCH] Ruby/Tk — Koji Arai <JCA02266@...>

新井です。

20 messages 1999/12/14
[#8651] Re: [PATCH] Ruby/Tk — Koji Arai <JCA02266@...> 1999/12/14

新井です。

[#8692] [win] dir name — KANEKO Naoshi <wbs01621@...>

金子です。

22 messages 1999/12/21
[#8695] Re: [win] dir name — Koji Oda <oda@...1.qnes.nec.co.jp> 1999/12/22

小田@QNES です。

[#8741] Re: [ruby-list:19945] Re: array + empty string — Wakou Aoyama <wakou@...>

青山です。

18 messages 1999/12/27
[#8743] Re: [ruby-list:19945] Re: array + empty string — matz@... (Yukihiro Matsumoto) 1999/12/28

まつもと ゆきひろです

[#8742] [REQ] Array#each{|a,b,...|}, Array#shift/pop(num) — Kazunori NISHI <kazunori@...>

西@九大です。

64 messages 1999/12/27
[#8744] Re: [REQ] Array#each{|a,b,...|}, Array#shift/pop(num) — matz@... (Yukihiro Matsumoto) 1999/12/28

まつもと ゆきひろです

[#8748] Re: [REQ] Array#each{|a,b,...|}, Array#shift/pop(num) — Kazunori NISHI <kazunori@...> 1999/12/28

西@九大です。

[#8751] Re: [REQ] Array#each{|a,b,...|}, Array#shift/pop(num) — matz@... (Yukihiro Matsumoto) 1999/12/28

まつもと ゆきひろです

[#8767] Re: [REQ] Array#each{|a,b,...|}, Array#shift/pop(num) — Kazunori NISHI <kazunori@...> 1999/12/29

西@九大です。

[#8777] Re: [REQ] Array#each{|a,b,...|}, Array#shift/pop(num) — matz@... (Yukihiro Matsumoto) 1999/12/30

まつもと ゆきひろです

[#8791] Re: [REQ] Array#each{|a,b,...|}, Array#shift/pop(num) — Minero Aoki <aamine@...> 1999/12/31

あおきです。

[#8792] Re: [REQ] Array#each{|a,b,...|}, Array#shift/pop(num) — matz@... (Yukihiro Matsumoto) 1999/12/31

まつもと ゆきひろです

[#8793] Re: [REQ] Array#each{|a,b,...|}, Array#shift/pop(num) — ARIMA Yasuhiro <fit0298@...> 1999/12/31

有馬です。

[#8795] Re: [REQ] Array#each{|a,b,...|}, Array#shift/pop(num) — Akinori MUSHA aka knu <knu@...> 1999/12/31

 knuです。

[#8798] Re: [REQ] Array#each{|a,b,...|}, Array#shift/pop(num) — matz@... (Yukihiro Matsumoto) 2000/01/01

まつもと ゆきひろです

[#8811] Re: [REQ] Array#each{|a,b,...|}, Array#shift/pop(num) — Akinori MUSHA aka knu <knu@...> 2000/01/03

 knuです。

[ruby-dev:8706] Re: [PATCH] Ruby/Tk

From: Koji Arai <JCA02266@...>
Date: 1999-12-23 14:26:30 UTC
List: ruby-dev #8706
新井です。

# 調子にのってまたパッチ付けます。関連パッチを集めるという意
# 味でこのままこのスレッドに続けます。

現状の、Ruby/Tkではウィジェットクラスに対してイベントコール
バック関数を登録できません。

で、以下を提案します。

・モジュールTkに以下のモジュールメソッドを追加
  (他のメソッドにならって実際にはインスタンスメソッドで定義してます)

  o Tk.bind
  o Tk.bind_append
  o Tk.bindinfo_all (Tk.bindinfo "all" と同じ。ついで)

  e.g.)
     require "tk"

     Tk.bind TkButton, "1", proc {p "button 1 pressed (class binding)"}
     p Tk.bindinfo TkButton, "1"

     b1 = TkButton.new.pack
     Tk.bind b1, "1", proc {p "button 1 pressed"}
     p Tk.bindinfo b1, "1"
     Tk.mainloop

     => [[#<Proc:0x40134b88>, "%# ... "]]
        [[#<Proc:0x401320f4>, "%# ... "]]

  e.g.)
     require "tk"
     p Tk.bindinfo_all
     p Tk.bindinfo_all "Tab"

     => ["Shift-Key-Tab", "Key-Tab", "Key-F10", "Alt-Key"]
        ["tkTabToWindow [tk_focusNext %W]"]

・モジュールTkBindを追加
  o TkBind#bind
  o TkBind#bind_append
  o TkBind#bindinfo

・TkBindをTkObjectでinclude、TkWindowで extend
  (include、extendするクラスの選別はあまり考えず元の定義に倣
  いました。TkWindowのオブジェクト以外でTkBindが必要なのかど
  うか考えてないので。もしかしたら、モジュールにする意味がな
  いかも知れない)

  o TkObject#bind
  o TkObject#bind_append
  o TkObject#bindinfo

  o TkWindow.bind
  o TkWindow.bind_append
  o TkWindow.bindinfo

  e.g.)
     require "tk"

     TkButton.bind "1", proc {p "button 1 pressed (class binding)"}
     p TkButton.bindinfo "1"

     b1 = TkButton.new.pack
     b1.bind "1", proc {p "button 1 pressed"}
     p b1.bindinfo "1"
     Tk.mainloop

     => [[#<Proc:0x40134ca0>, "%# ... "]]
        [[#<Proc:0x401322d4>, "%# ... "]]

・以下のようにしたとき、bindtagsがエラーになるので修正しました。

  ruby -rtk -e 'b = TkButton.new' -e 'b.bindtags [Tk.root]' -e 'p b.bindtags'
  => -e:3: undefined local variable or method `collect' \
     for #<TkRoot:0x40134858> (NameError)

・bindtags の以下の部分は必要ないように思えましたので削除しました。
  (自信はない)

tk_split_list(tk_call('bindtags', path)).collect{|tag|
  if tag == nil        <- ココ
    "."                <- ココ
  elsif ....
}


--- ext/tk/lib/tk.rb.old	Tue Dec 21 23:03:34 1999
+++ ext/tk/lib/tk.rb	Thu Dec 23 22:58:21 1999
@@ -349,6 +349,14 @@ module TkComm
   end
   private :install_bind, :tk_event_sequence, :_bind_core, :_bind, :_bind_append
 
+  def bind(tagOrClass, context, cmd=Proc.new, args=nil)
+    _bind(['bind', tagOrClass], context, cmd, args)
+  end
+
+  def bind_append(tagOrClass, context, cmd=Proc.new, args=nil)
+    _bind_append(['bind', tagOrClass], context, cmd, args)
+  end
+
   def bind_all(context, cmd=Proc.new, args=nil)
     _bind(['bind', 'all'], context, cmd, args)
   end
@@ -372,11 +380,16 @@ module TkComm
       }
     end
   end
+  private :_bindinfo
 
   def bindinfo(tagOrClass, context=nil)
     _bindinfo(['bind', tagOrClass], context)
   end
 
+  def bindinfo_all(context=nil)
+    _bindinfo(['bind', 'all'], context)
+  end
+
   def pack(*args)
     TkPack.configure *args
   end
@@ -1573,9 +1586,24 @@ module TkTreatFont
   end
 end
 
+module TkBind
+  def bind(context, cmd=Proc.new, args=nil)
+    Tk.bind(to_eval, context, cmd, args)
+  end
+
+  def bind_append(context, cmd=Proc.new, args=nil)
+    Tk.bind_append(to_eval, context, cmd, args)
+  end
+
+  def bindinfo(context=nil)
+    Tk.bindinfo(to_eval, context)
+  end
+end
+
 class TkObject<TkKernel
   include Tk
   include TkTreatFont
+  include TkBind
 
   def path
     return @path
@@ -1672,18 +1700,6 @@ class TkObject<TkKernel
     end
   end
 
-  def bind(context, cmd=Proc.new, args=nil)
-    _bind(["bind", to_eval], context, cmd, args)
-  end
-
-  def bind_append(context, cmd=Proc.new, args=nil)
-    _bind_append(["bind", to_eval], context, cmd, args)
-  end
-
-  def bindinfo(context=nil)
-    _bindinfo(['bind', to_eval], context)
-  end
-
   def event_generate(context, keys=nil)
     if keys
       tk_call('event', 'generate', path, 
@@ -1707,7 +1723,7 @@ class TkObject<TkKernel
 end
 
 class TkWindow<TkObject
-#  extend TkClassBind
+  extend TkBind
 
   def initialize(parent=nil, keys=nil)
     install_win(if parent then parent.path end)
@@ -1855,10 +1871,8 @@ class TkWindow<TkObject
       fail unless taglist.kind_of? Array
       tk_call('bindtags', path, taglist)
     else
-      tk_split_list(tk_call('bindtags', path)).collect{|tag|
-	if tag == nil
-	  '.'
-	elsif tag.kind_of?(String) && (cls = WidgetClassNames[tag])
+      list(tk_call('bindtags', path)).collect{|tag|
+	if tag.kind_of?(String) && (cls = WidgetClassNames[tag])
 	  cls
 	else
 	  tag

--
新井康司 (Koji Arai)

In This Thread