It seems to me that there is a bug on TkBindTag.new_by_name.
Here is an example:
# The action on new_by_name has no effect ?! bug ?
require 'tk'
TkBindTag.new_by_name('My_BindTag', 'Button') {|e| puts 'OK'}
TkLabel.new(:text=>:Test).pack.bindtags = ['My_BandTag']
Tk.mainloop
However, this works:
require 'tk'
b = TkBindTag.new_by_name('My_BindTag')
b.bind('Button') {|e| puts 'OK'}
TkLabel.new(:text=>:Test).pack.bindtags = ['My_BandTag']
Tk.mainloop
By looking on the source code of TkBindTag, it seems on the new_by_name:
BTagID_TBL.delete @id ==> also delete the old action
the new one just has its name but no action associate to it.
That is maybe why the new_by_name action has no effect.
This seems a bug ?
Thanks.
Hi,
Message-ID: <91b08b8a0412141702e8bc791@mail.gmail.com>
It seems to me that there is a bug on TkBindTag.new_by_name.
Here is an example:
(snip)
This seems a bug ?
Yes. You are right.
Please replace TkBindTag.new_by_name to the following.
ยทยทยท
From: email55555 email55555 <email55555@gmail.com>
Subject: [Tk] Bug on TkBindTag.new_by_name ?
Date: Wed, 15 Dec 2004 10:02:11 +0900
-----------------------------------------------------
def TkBindTag.new_by_name(name, *args, &b)
return BTagID_TBL[name] if BTagID_TBL[name]
self.new.instance_eval{
BTagID_TBL.delete @id
@id = name
BTagID_TBL[@id] = self
bind(*args, &b) if args !=
}
end
-----------------------------------------------------
Thank you for your report.
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)