summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib/tk')
-rw-r--r--ext/tk/lib/tk/bindtag.rb3
-rw-r--r--ext/tk/lib/tk/canvas.rb6
-rw-r--r--ext/tk/lib/tk/canvastag.rb6
-rw-r--r--ext/tk/lib/tk/dialog.rb31
-rw-r--r--ext/tk/lib/tk/optiondb.rb7
-rw-r--r--ext/tk/lib/tk/text.rb38
-rw-r--r--ext/tk/lib/tk/texttag.rb22
-rw-r--r--ext/tk/lib/tk/textwindow.rb10
-rw-r--r--ext/tk/lib/tk/timer.rb33
-rw-r--r--ext/tk/lib/tk/validation.rb6
10 files changed, 93 insertions, 69 deletions
diff --git a/ext/tk/lib/tk/bindtag.rb b/ext/tk/lib/tk/bindtag.rb
index adf96b9e3d..737223e3df 100644
--- a/ext/tk/lib/tk/bindtag.rb
+++ b/ext/tk/lib/tk/bindtag.rb
@@ -18,10 +18,11 @@ class TkBindTag
def TkBindTag.new_by_name(name, *args, &b)
return BTagID_TBL[name] if BTagID_TBL[name]
- self.new(*args, &b).instance_eval{
+ self.new.instance_eval{
BTagID_TBL.delete @id
@id = name
BTagID_TBL[@id] = self
+ bind(*args, &b) if args != []
}
end
diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb
index 3bc08e94fc..a0543cc42d 100644
--- a/ext/tk/lib/tk/canvas.rb
+++ b/ext/tk/lib/tk/canvas.rb
@@ -99,7 +99,8 @@ class TkCanvas<TkWindow
# self
#end
def itembind(tag, context, *args)
- if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -113,7 +114,8 @@ class TkCanvas<TkWindow
# self
#end
def itembind_append(tag, context, *args)
- if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
diff --git a/ext/tk/lib/tk/canvastag.rb b/ext/tk/lib/tk/canvastag.rb
index 5d1d5e92ab..2eec6e3ca1 100644
--- a/ext/tk/lib/tk/canvastag.rb
+++ b/ext/tk/lib/tk/canvastag.rb
@@ -26,7 +26,8 @@ module TkcTagAccess
# self
#end
def bind(seq, *args)
- if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -40,7 +41,8 @@ module TkcTagAccess
# self
#end
def bind_append(seq, *args)
- if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
diff --git a/ext/tk/lib/tk/dialog.rb b/ext/tk/lib/tk/dialog.rb
index f7d17b5a96..5b627d7c03 100644
--- a/ext/tk/lib/tk/dialog.rb
+++ b/ext/tk/lib/tk/dialog.rb
@@ -30,21 +30,21 @@ class TkDialogObj < TkWindow
case configs
when Proc
@buttons.each_index{|i|
- if (c = configs.call(i)).kind_of? Hash
+ if (c = configs.call(i)).kind_of?(Hash)
set_config.call(c,i)
end
}
when Array
@buttons.each_index{|i|
- if (c = configs[i]).kind_of? Hash
+ if (c = configs[i]).kind_of?(Hash)
set_config.call(c,i)
end
}
when Hash
@buttons.each_with_index{|s,i|
- if (c = configs[s]).kind_of? Hash
+ if (c = configs[s]).kind_of?(Hash)
set_config.call(c,i)
end
}
@@ -78,7 +78,7 @@ class TkDialogObj < TkWindow
@command = prev_command
- if keys.kind_of? Hash
+ if keys.kind_of?(Hash)
@title = keys['title'] if keys.key? 'title'
@message = keys['message'] if keys.key? 'message'
@bitmap = keys['bitmap'] if keys.key? 'bitmap'
@@ -99,18 +99,18 @@ class TkDialogObj < TkWindow
@title = '{' + @title + '}'
end
- if @buttons.kind_of? Array
+ if @buttons.kind_of?(Array)
_set_button_config(@buttons.collect{|cfg|
(cfg.kind_of? Array)? cfg[1]: nil})
@buttons = @buttons.collect{|cfg| (cfg.kind_of? Array)? cfg[0]: cfg}
end
- if @buttons.kind_of? Hash
+ if @buttons.kind_of?(Hash)
_set_button_config(@buttons)
@buttons = @buttons.keys
end
- @buttons = tk_split_simplelist(@buttons) if @buttons.kind_of? String
+ @buttons = tk_split_simplelist(@buttons) if @buttons.kind_of?(String)
@buttons = @buttons.collect{|s|
- if s.kind_of? Array
+ if s.kind_of?(Array)
s = s.join(' ')
end
if s.include? ?\s
@@ -120,7 +120,7 @@ class TkDialogObj < TkWindow
end
}
- if @message_config.kind_of? Hash
+ if @message_config.kind_of?(Hash)
# @config << Kernel.format("%s.msg configure %s;",
# @path, hash_kv(@message_config).join(' '))
# @config << @path+'.msg configure '+hash_kv(@message_config).join(' ')+';'
@@ -128,7 +128,7 @@ class TkDialogObj < TkWindow
array2tk_list(hash_kv(@message_config))+';'
end
- if @msgframe_config.kind_of? Hash
+ if @msgframe_config.kind_of?(Hash)
# @config << Kernel.format("%s.top configure %s;",
# @path, hash_kv(@msgframe_config).join(' '))
# @config << @path+'.top configure '+hash_kv(@msgframe_config).join(' ')+';'
@@ -136,7 +136,7 @@ class TkDialogObj < TkWindow
array2tk_list(hash_kv(@msgframe_config))+';'
end
- if @btnframe_config.kind_of? Hash
+ if @btnframe_config.kind_of?(Hash)
# @config << Kernel.format("%s.bot configure %s;",
# @path, hash_kv(@btnframe_config).join(' '))
# @config << @path+'.bot configure '+hash_kv(@btnframe_config).join(' ')+';'
@@ -144,7 +144,7 @@ class TkDialogObj < TkWindow
array2tk_list(hash_kv(@btnframe_config))+';'
end
- if @bitmap_config.kind_of? Hash
+ if @bitmap_config.kind_of?(Hash)
# @config << Kernel.format("%s.bitmap configure %s;",
# @path, hash_kv(@bitmap_config).join(' '))
# @config << @path+'.bitmap configure '+hash_kv(@bitmap_config).join(' ')+';'
@@ -157,11 +157,12 @@ class TkDialogObj < TkWindow
private :create_self
def show
- if @command.kind_of? Proc
+ # if @command.kind_of?(Proc)
+ if TkComm._callback_entry?(@command)
@command.call(self)
end
- if @default_button.kind_of? String
+ if @default_button.kind_of?(String)
default_button = @buttons.index(@default_button)
else
default_button = @default_button
@@ -265,7 +266,7 @@ end
class TkWarningObj < TkDialogObj
def initialize(parent = nil, mes = nil)
if !mes
- if parent.kind_of? TkWindow
+ if parent.kind_of?(TkWindow)
mes = ""
else
mes = parent.to_s
diff --git a/ext/tk/lib/tk/optiondb.rb b/ext/tk/lib/tk/optiondb.rb
index 1484671920..fe79de123c 100644
--- a/ext/tk/lib/tk/optiondb.rb
+++ b/ext/tk/lib/tk/optiondb.rb
@@ -178,7 +178,8 @@ module TkOptionDB
proc_source = TkOptionDB.get(self::CARRIER, id.id2name, '').strip
res_proc = nil if proc_str != proc_source # resource is changed
- unless res_proc.kind_of? Proc
+ # unless res_proc.kind_of?(Proc)
+ unless TkComm._callback_entry?(res_proc)
#if id == :new || !(self::METHOD_TBL.has_key?(id) || self::ADD_METHOD)
if id == :new || !(@method_tbl.has_key?(id) || @add_method)
raise NoMethodError,
@@ -253,7 +254,7 @@ module TkOptionDB
CmdClassID[1].succ!
parent = nil # ignore parent
else
- klass = klass.to_s if klass.kind_of? Symbol
+ klass = klass.to_s if klass.kind_of?(Symbol)
unless (?A..?Z) === klass[0]
fail ArgumentError, "bad string '#{klass}' for class name"
end
@@ -269,7 +270,7 @@ module TkOptionDB
carrier = Tk.tk_call_without_enc('frame', @path, '-class', klass)
end
- unless func.kind_of? Array
+ unless func.kind_of?(Array)
fail ArgumentError, "method-list must be Array"
end
func_str = func.join(' ')
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
index 49b769403a..a79f50616a 100644
--- a/ext/tk/lib/tk/text.rb
+++ b/ext/tk/lib/tk/text.rb
@@ -215,7 +215,7 @@ class TkText<TkTextWin
end
def image_configure(index, slot, value=None)
- if slot.kind_of? Hash
+ if slot.kind_of?(Hash)
_fromUTF8(tk_send_without_enc('image', 'configure',
_get_eval_enc_str(index),
*hash_kv(slot, true)))
@@ -347,7 +347,7 @@ class TkText<TkTextWin
end
def insert(index, chars, *tags)
- if tags[0].kind_of? Array
+ if tags[0].kind_of?(Array)
# multiple chars-taglist argument :: str, [tag,...], str, [tag,...], ...
args = [chars]
while tags.size > 0
@@ -507,7 +507,7 @@ class TkText<TkTextWin
*(tags.collect{|tag| _get_eval_enc_str(tag)}))
if TkTextTag::TTagID_TBL[@path]
tags.each{|tag|
- if tag.kind_of? TkTextTag
+ if tag.kind_of?(TkTextTag)
TkTextTag::TTagID_TBL[@path].delete(tag.id)
else
TkTextTag::TTagID_TBL[@path].delete(tag)
@@ -524,7 +524,8 @@ class TkText<TkTextWin
# self
#end
def tag_bind(tag, seq, *args)
- if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -538,7 +539,8 @@ class TkText<TkTextWin
# self
#end
def tag_bind_append(tag, seq, *args)
- if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -580,7 +582,7 @@ class TkText<TkTextWin
end
def tag_configure(tag, key, val=None)
- if key.kind_of? Hash
+ if key.kind_of?(Hash)
key = _symbolkey2str(key)
if ( key['font'] || key['kanjifont'] \
|| key['latinfont'] || key['asciifont'] )
@@ -798,17 +800,17 @@ class TkText<TkTextWin
end
def window_configure(index, slot, value=None)
- if index.kind_of? TkTextWindow
+ if index.kind_of?(TkTextWindow)
index.configure(slot, value)
else
- if slot.kind_of? Hash
+ if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
win = slot['window']
# slot['window'] = win.epath if win.kind_of?(TkWindow)
slot['window'] = _epath(win) if win
if slot['create']
p_create = slot['create']
- if p_create.kind_of? Proc
+ if p_create.kind_of?(Proc)
#=begin
slot['create'] = install_cmd(proc{
id = p_create.call
@@ -833,7 +835,7 @@ class TkText<TkTextWin
end
if slot == 'create' || slot == :create
p_create = value
- if p_create.kind_of? Proc
+ if p_create.kind_of?(Proc)
#=begin
value = install_cmd(proc{
id = p_create.call
@@ -1054,7 +1056,7 @@ class TkText<TkTextWin
end
def search_with_length(pat,start,stop=None)
- pat = pat.chr if pat.kind_of? Integer
+ pat = pat.chr if pat.kind_of?(Integer)
if stop != None
return ["", 0] if compare(start,'>=',stop)
txt = get(start,stop)
@@ -1062,7 +1064,7 @@ class TkText<TkTextWin
match = $&
#pos = txt[0..(pos-1)].split('').length if pos > 0
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
- if pat.kind_of? String
+ if pat.kind_of?(String)
#return [index(start + " + #{pos} chars"), pat.split('').length]
return [index(start + " + #{pos} chars"),
_ktext_length(pat), pat.dup]
@@ -1080,7 +1082,7 @@ class TkText<TkTextWin
match = $&
#pos = txt[0..(pos-1)].split('').length if pos > 0
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
- if pat.kind_of? String
+ if pat.kind_of?(String)
#return [index(start + " + #{pos} chars"), pat.split('').length]
return [index(start + " + #{pos} chars"),
_ktext_length(pat), pat.dup]
@@ -1095,7 +1097,7 @@ class TkText<TkTextWin
match = $&
#pos = txt[0..(pos-1)].split('').length if pos > 0
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
- if pat.kind_of? String
+ if pat.kind_of?(String)
#return [index("1.0 + #{pos} chars"), pat.split('').length]
return [index("1.0 + #{pos} chars"),
_ktext_length(pat), pat.dup]
@@ -1115,7 +1117,7 @@ class TkText<TkTextWin
end
def rsearch_with_length(pat,start,stop=None)
- pat = pat.chr if pat.kind_of? Integer
+ pat = pat.chr if pat.kind_of?(Integer)
if stop != None
return ["", 0] if compare(start,'<=',stop)
txt = get(stop,start)
@@ -1123,7 +1125,7 @@ class TkText<TkTextWin
match = $&
#pos = txt[0..(pos-1)].split('').length if pos > 0
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
- if pat.kind_of? String
+ if pat.kind_of?(String)
#return [index(stop + " + #{pos} chars"), pat.split('').length]
return [index(stop + " + #{pos} chars"), _ktext_length(pat), pat.dup]
else
@@ -1139,7 +1141,7 @@ class TkText<TkTextWin
match = $&
#pos = txt[0..(pos-1)].split('').length if pos > 0
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
- if pat.kind_of? String
+ if pat.kind_of?(String)
#return [index("1.0 + #{pos} chars"), pat.split('').length]
return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
else
@@ -1152,7 +1154,7 @@ class TkText<TkTextWin
match = $&
#pos = txt[0..(pos-1)].split('').length if pos > 0
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
- if pat.kind_of? String
+ if pat.kind_of?(String)
#return [index("1.0 + #{pos} chars"), pat.split('').length]
return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
else
diff --git a/ext/tk/lib/tk/texttag.rb b/ext/tk/lib/tk/texttag.rb
index 37b83cc4aa..a80f4780c0 100644
--- a/ext/tk/lib/tk/texttag.rb
+++ b/ext/tk/lib/tk/texttag.rb
@@ -32,9 +32,9 @@ class TkTextTag<TkObject
TTagID_TBL[@tpath][@id] = self
Tk_TextTag_ID[1].succ!
#tk_call @t.path, "tag", "configure", @id, *hash_kv(keys)
- if args != [] then
+ if args != []
keys = args.pop
- if keys.kind_of? Hash then
+ if keys.kind_of?(Hash)
add(*args) if args != []
configure(keys)
else
@@ -139,7 +139,7 @@ class TkTextTag<TkObject
@t.tag_configure @id, key, val
end
# def configure(key, val=None)
-# if key.kind_of? Hash
+# if key.kind_of?(Hash)
# tk_call @t.path, 'tag', 'configure', @id, *hash_kv(key)
# else
# tk_call @t.path, 'tag', 'configure', @id, "-#{key}", val
@@ -148,7 +148,7 @@ class TkTextTag<TkObject
# def configure(key, value)
# if value == FALSE
# value = "0"
-# elsif value.kind_of? Proc
+# elsif value.kind_of?(Proc)
# value = install_cmd(value)
# end
# tk_call @t.path, 'tag', 'configure', @id, "-#{key}", value
@@ -167,7 +167,8 @@ class TkTextTag<TkObject
# self
#end
def bind(seq, *args)
- if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -181,7 +182,8 @@ class TkTextTag<TkObject
# self
#end
def bind_append(seq, *args)
- if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ if TkComm._callback_entry?(args[0])
cmd = args.shift
else
cmd = Proc.new
@@ -222,9 +224,9 @@ class TkTextNamedTag<TkTextTag
def self.new(parent, name, *args)
if TTagID_TBL[parent.path] && TTagID_TBL[parent.path][name]
tagobj = TTagID_TBL[parent.path][name]
- if args != [] then
+ if args != []
keys = args.pop
- if keys.kind_of? Hash then
+ if keys.kind_of?(Hash)
tagobj.add(*args) if args != []
tagobj.configure(keys)
else
@@ -250,9 +252,9 @@ class TkTextNamedTag<TkTextTag
#if mode
# tk_call @t.path, "addtag", @id, *args
#end
- if args != [] then
+ if args != []
keys = args.pop
- if keys.kind_of? Hash then
+ if keys.kind_of?(Hash)
add(*args) if args != []
configure(keys)
else
diff --git a/ext/tk/lib/tk/textwindow.rb b/ext/tk/lib/tk/textwindow.rb
index 59fafff181..c53cbe1a70 100644
--- a/ext/tk/lib/tk/textwindow.rb
+++ b/ext/tk/lib/tk/textwindow.rb
@@ -13,7 +13,7 @@ class TkTextWindow<TkObject
if index == 'end'
@path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
'end - 1 chars'))
- elsif index.kind_of? TkTextMark
+ elsif index.kind_of?(TkTextMark)
if tk_call_without_enc(@t.path,'index',index.path) == tk_call_without_enc(@t.path,'index','end')
@path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
'end - 1 chars'))
@@ -32,7 +32,8 @@ class TkTextWindow<TkObject
keys['window'] = _epath(@id) if @id
if keys['create']
@p_create = keys['create']
- if @p_create.kind_of? Proc
+ # if @p_create.kind_of?(Proc)
+ if TkComm._callback_entry?(@p_create)
=begin
keys['create'] = install_cmd(proc{
@id = @p_create.call
@@ -63,7 +64,7 @@ class TkTextWindow<TkObject
end
def configure(slot, value=None)
- if slot.kind_of? Hash
+ if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
if slot['window']
@id = slot['window']
@@ -120,7 +121,8 @@ class TkTextWindow<TkObject
def create=(value)
@p_create = value
- if @p_create.kind_of? Proc
+ # if @p_create.kind_of?(Proc)
+ if TkComm._callback_entry?(@p_create)
value = install_cmd(proc{
@id = @p_create.call
if @id.kind_of?(TkWindow)
diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb
index f3b6465f78..a1f43fa864 100644
--- a/ext/tk/lib/tk/timer.rb
+++ b/ext/tk/lib/tk/timer.rb
@@ -122,7 +122,8 @@ class TkTimer
@current_args = args
- if @sleep_time.kind_of? Proc
+ # if @sleep_time.kind_of?(Proc)
+ if TkComm._callback_entry?(@sleep_time)
sleep = @sleep_time.call(self)
else
sleep = @sleep_time
@@ -244,23 +245,28 @@ class TkTimer
end
def set_interval(interval)
- if interval != 'idle' \
- && !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
+ #if interval != 'idle' && interval != :idle \
+ # && !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
+ if interval != 'idle' && interval != :idle \
+ && !interval.kind_of?(Integer) && !TkComm._callback_entry?(interval)
fail ArguemntError, "expect Integer or Proc"
end
@sleep_time = interval
end
def set_procs(interval, loop_exec, *procs)
- if interval != 'idle' \
- && !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
+ #if interval != 'idle' && interval != :idle \
+ # && !interval.kind_of?(Integer) && !interval.kind_of?(Proc)
+ if interval != 'idle' && interval != :idle \
+ && !interval.kind_of?(Integer) && !TkComm._callback_entry?(interval)
fail ArguemntError, "expect Integer or Proc for 1st argument"
end
@sleep_time = interval
@loop_proc = []
procs.each{|e|
- if e.kind_of? Proc
+ # if e.kind_of?(Proc)
+ if TkComm._callback_entry?(e)
@loop_proc.push([e])
else
@loop_proc.push(e)
@@ -288,7 +294,8 @@ class TkTimer
def add_procs(*procs)
procs.each{|e|
- if e.kind_of? Proc
+ # if e.kind_of?(Proc)
+ if TkComm._callback_entry?(e)
@loop_proc.push([e])
else
@loop_proc.push(e)
@@ -301,7 +308,8 @@ class TkTimer
def delete_procs(*procs)
procs.each{|e|
- if e.kind_of? Proc
+ # if e.kind_of?(Proc)
+ if TkComm._callback_entry?(e)
@loop_proc.delete([e])
else
@loop_proc.delete(e)
@@ -325,7 +333,7 @@ class TkTimer
# set parameters for 'restart'
sleep = @init_sleep unless sleep
- if !sleep == 'idle' && !sleep.kind_of?(Integer)
+ if sleep != 'idle' && sleep != :idle && !sleep.kind_of?(Integer)
fail ArguemntError, "expect Integer or 'idle' for 1st argument"
end
@@ -354,7 +362,7 @@ class TkTimer
argc = init_args.size
if argc > 0
sleep = init_args.shift
- if !sleep == 'idle' && !sleep.kind_of?(Integer)
+ if sleep != 'idle' && sleep != :idle && !sleep.kind_of?(Integer)
fail ArguemntError, "expect Integer or 'idle' for 1st argument"
end
@init_sleep = sleep
@@ -368,7 +376,8 @@ class TkTimer
@current_sleep = @init_sleep
@running = true
if @init_proc
- if not @init_proc.kind_of? Proc
+ # if not @init_proc.kind_of?(Proc)
+ if !TkComm._callback_entry?(@init_proc)
fail ArgumentError, "Argument '#{@init_proc}' need to be Proc"
end
@current_proc = @init_proc
@@ -421,7 +430,7 @@ class TkTimer
sleep, cmd = @current_script
fail RuntimeError, "no procedure to continue" unless cmd
if wait
- unless wait.kind_of? Integer
+ unless wait.kind_of?(Integer)
fail ArguemntError, "expect Integer for 1st argument"
end
sleep = wait
diff --git a/ext/tk/lib/tk/validation.rb b/ext/tk/lib/tk/validation.rb
index 5a50de456d..eeb0163ee4 100644
--- a/ext/tk/lib/tk/validation.rb
+++ b/ext/tk/lib/tk/validation.rb
@@ -51,7 +51,8 @@ module Tk
if keys[key].kind_of?(Array)
cmd, *args = keys[key]
keys[key] = klass.new(cmd, args.join(' '))
- elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
+ # elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
+ elsif TkComm._callback_entry?(keys[key])
keys[key] = klass.new(keys[key])
end
}
@@ -151,7 +152,8 @@ module Tk
if keys[key].kind_of?(Array)
cmd, *args = keys[key]
keys[key] = klass.new(cmd, args.join(' '))
- elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
+ # elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
+ elsif TkComm._callback_entry?(keys[key])
keys[key] = klass.new(keys[key])
end
}