mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 17:43:59 +02:00
* ext/tk/tkutil/tkutil.c: improve handling callback-subst-keys.
Now, support longnam-keys (e.g. '%CTT' on tkdnd-2.0; however, still not support tkdnd-2.0 on tkextlib), and symbols of parameters (e.g. :widget=>'%W', :keycode=>'%k', '%x'=>:x, '%X'=>:root_x, and so on; those are attributes of event object). It means that Ruby/Tk accepts not only "widget.bind(ev, '%W', '%k', ...){|w, k, ...| ... }", but also "widget.bind(ev, :widget, :keycode, ...){|w, k, ...| ... }". It is potentially incompatible, when user passes symbols to the arguments of the callback block (the block receives the symbols as strings). I think that is very rare case (probably, used by Ruby/Tk experts only). When causes such trouble, please give strings instead of such symbol parameters (e.g. call Symbol#to_s method). * ext/tk/lib/tk/event.rb, ext/tk/lib/tk/validation.rb, ext/tk/lib/tkextlib/blt/treeview.rb, ext/tk/lib/tkextlib/winico/winico.rb: ditto. * ext/tk/tkutil/tkutil.c: strings are available on subst_tables on TkUtil::CallbackSubst class (it is useful on Ruby 1.9). * ext/tk/lib/tk/spinbox.rb, ext/tk/lib/tkextlib/iwidgets/hierarchy.rb, ext/tk/lib/tkextlib/iwidgets/spinner.rb, ext/tk/lib/tkextlib/iwidgets/entryfield.rb, ext/tk/lib/tkextlib/iwidgets/calendar.rb, ext/tk/lib/tkextlib/blt/dragdrop.rb, ext/tk/lib/tkextlib/tkDND/tkdnd.rb, ext/tk/lib/tkextlib/treectrl/tktreectrl.rb, ext/tk/lib/tkextlib/tktable/tktable.rb: disable code piece became unnecessary by reason of the changes of ext/tk/tkutil/tkutil.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8cf1995901
commit
d37d14c0a5
17 changed files with 410 additions and 166 deletions
|
@ -31,6 +31,7 @@ class Tk::Iwidgets::Hierarchy
|
|||
KEY_TBL = [ [?n, ?s, :node], nil ]
|
||||
PROC_TBL = [ [?s, TkComm.method(:string) ], nil ]
|
||||
|
||||
=begin
|
||||
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
|
||||
KEY_TBL.map!{|inf|
|
||||
if inf.kind_of?(Array)
|
||||
|
@ -46,6 +47,7 @@ class Tk::Iwidgets::Hierarchy
|
|||
end
|
||||
inf
|
||||
}
|
||||
=end
|
||||
|
||||
_setup_subst_table(KEY_TBL, PROC_TBL);
|
||||
|
||||
|
@ -74,6 +76,7 @@ class Tk::Iwidgets::Hierarchy
|
|||
nil
|
||||
]
|
||||
|
||||
=begin
|
||||
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
|
||||
KEY_TBL.map!{|inf|
|
||||
if inf.kind_of?(Array)
|
||||
|
@ -89,6 +92,7 @@ class Tk::Iwidgets::Hierarchy
|
|||
end
|
||||
inf
|
||||
}
|
||||
=end
|
||||
|
||||
_setup_subst_table(KEY_TBL, PROC_TBL);
|
||||
|
||||
|
@ -112,6 +116,7 @@ class Tk::Iwidgets::Hierarchy
|
|||
]
|
||||
PROC_TBL = [ [ ?s, TkComm.method(:string) ], nil ]
|
||||
|
||||
=begin
|
||||
# for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
|
||||
KEY_TBL.map!{|inf|
|
||||
if inf.kind_of?(Array)
|
||||
|
@ -127,6 +132,7 @@ class Tk::Iwidgets::Hierarchy
|
|||
end
|
||||
inf
|
||||
}
|
||||
=end
|
||||
|
||||
_setup_subst_table(KEY_TBL, PROC_TBL);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue