tk 0.1.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/MANUAL_tcltklib.eng +0 -2
  4. data/MANUAL_tcltklib.ja +0 -2
  5. data/README.ActiveTcl +1 -1
  6. data/README.md +53 -1
  7. data/ext/tk/extconf.rb +4 -2
  8. data/ext/tk/old-extconf.rb +0 -1
  9. data/ext/tk/tcltklib.c +47 -149
  10. data/ext/tk/tkutil/extconf.rb +0 -2
  11. data/ext/tk/tkutil/tkutil.c +6 -9
  12. data/lib/multi-tk.rb +99 -320
  13. data/lib/remote-tk.rb +8 -25
  14. data/lib/tk.rb +49 -130
  15. data/lib/tk/autoload.rb +3 -3
  16. data/lib/tk/bgerror.rb +2 -2
  17. data/lib/tk/bindtag.rb +1 -1
  18. data/lib/tk/canvas.rb +7 -15
  19. data/lib/tk/canvastag.rb +11 -19
  20. data/lib/tk/entry.rb +1 -1
  21. data/lib/tk/font.rb +1 -1
  22. data/lib/tk/fontchooser.rb +1 -1
  23. data/lib/tk/grid.rb +4 -4
  24. data/lib/tk/image.rb +1 -1
  25. data/lib/tk/itemconfig.rb +4 -4
  26. data/lib/tk/itemfont.rb +3 -3
  27. data/lib/tk/listbox.rb +1 -1
  28. data/lib/tk/menu.rb +4 -4
  29. data/lib/tk/menuspec.rb +0 -1
  30. data/lib/tk/msgcat.rb +5 -5
  31. data/lib/tk/namespace.rb +14 -34
  32. data/lib/tk/optiondb.rb +3 -74
  33. data/lib/tk/optionobj.rb +1 -1
  34. data/lib/tk/scale.rb +3 -3
  35. data/lib/tk/scrollable.rb +4 -2
  36. data/lib/tk/selection.rb +5 -4
  37. data/lib/tk/text.rb +9 -17
  38. data/lib/tk/textmark.rb +1 -1
  39. data/lib/tk/texttag.rb +7 -15
  40. data/lib/tk/timer.rb +2 -2
  41. data/lib/tk/tk_mac.rb +18 -18
  42. data/lib/tk/validation.rb +6 -37
  43. data/lib/tk/variable.rb +10 -8
  44. data/lib/tk/virtevent.rb +1 -1
  45. data/lib/tk/winfo.rb +1 -1
  46. data/lib/tkextlib/blt/barchart.rb +0 -17
  47. data/lib/tkextlib/blt/bitmap.rb +1 -1
  48. data/lib/tkextlib/blt/component.rb +40 -40
  49. data/lib/tkextlib/blt/dragdrop.rb +6 -6
  50. data/lib/tkextlib/blt/graph.rb +0 -17
  51. data/lib/tkextlib/blt/stripchart.rb +0 -17
  52. data/lib/tkextlib/blt/tabset.rb +16 -31
  53. data/lib/tkextlib/blt/tree.rb +6 -6
  54. data/lib/tkextlib/blt/treeview.rb +14 -14
  55. data/lib/tkextlib/blt/watch.rb +1 -1
  56. data/lib/tkextlib/bwidget/labelentry.rb +6 -14
  57. data/lib/tkextlib/bwidget/listbox.rb +13 -29
  58. data/lib/tkextlib/bwidget/notebook.rb +6 -14
  59. data/lib/tkextlib/bwidget/progressdlg.rb +2 -2
  60. data/lib/tkextlib/bwidget/spinbox.rb +6 -14
  61. data/lib/tkextlib/bwidget/tree.rb +19 -35
  62. data/lib/tkextlib/itcl/incr_tcl.rb +2 -2
  63. data/lib/tkextlib/itk/incr_tk.rb +7 -29
  64. data/lib/tkextlib/iwidgets/calendar.rb +0 -15
  65. data/lib/tkextlib/iwidgets/entryfield.rb +1 -22
  66. data/lib/tkextlib/iwidgets/notebook.rb +2 -2
  67. data/lib/tkextlib/iwidgets/promptdialog.rb +1 -1
  68. data/lib/tkextlib/iwidgets/scrolledcanvas.rb +6 -14
  69. data/lib/tkextlib/iwidgets/spinner.rb +1 -1
  70. data/lib/tkextlib/iwidgets/tabnotebook.rb +2 -2
  71. data/lib/tkextlib/iwidgets/tabset.rb +1 -1
  72. data/lib/tkextlib/pkg_checker.rb +1 -1
  73. data/lib/tkextlib/tcllib/crosshair.rb +2 -2
  74. data/lib/tkextlib/tcllib/ctext.rb +2 -2
  75. data/lib/tkextlib/tcllib/plotchart.rb +5 -5
  76. data/lib/tkextlib/tcllib/tablelist_core.rb +3 -3
  77. data/lib/tkextlib/tcllib/validator.rb +6 -6
  78. data/lib/tkextlib/tile.rb +1 -2
  79. data/lib/tkextlib/tile/style.rb +1 -1
  80. data/lib/tkextlib/tile/treeview.rb +15 -22
  81. data/lib/tkextlib/tkDND/tkdnd.rb +63 -24
  82. data/lib/tkextlib/tkHTML/htmlwidget.rb +1 -1
  83. data/lib/tkextlib/tktable/tktable.rb +2 -2
  84. data/lib/tkextlib/treectrl/tktreectrl.rb +13 -21
  85. data/lib/tkextlib/vu/pie.rb +1 -1
  86. data/sample/binding_sample.rb +2 -2
  87. data/sample/cmd_res_test.rb +1 -1
  88. data/sample/demos-en/widget +21 -21
  89. data/sample/demos-jp/widget +4 -4
  90. data/sample/multi-ip_sample.rb +0 -3
  91. data/sample/multi-ip_sample2.rb +1 -1
  92. data/sample/resource.en +3 -3
  93. data/sample/resource.ja +3 -3
  94. data/sample/tcltklib/sample1.rb +2 -2
  95. data/sample/tkballoonhelp.rb +2 -2
  96. data/sample/tkextlib/tkHTML/ss.rb +0 -6
  97. data/sample/tkmulticolumnlist.rb +2 -2
  98. data/sample/tkmultilistframe.rb +2 -2
  99. data/sample/tkoptdb.rb +14 -16
  100. data/tk.gemspec +7 -8
  101. metadata +13 -15
  102. data/ChangeLog.tkextlib +0 -949
  103. data/old-README.tcltklib.ja +0 -159
  104. data/sample/binstr_usage.rb +0 -46
  105. data/sample/remote-ip_sample2.rb +0 -57
  106. data/sample/safe-tk.rb +0 -132
  107. data/sample/tkoptdb-safeTk.rb +0 -74
  108. data/sample/tktree.rb +0 -104
  109. data/sample/tktree.tcl +0 -305
@@ -41,12 +41,12 @@ module Tk
41
41
  class ItclObject < TkObject
42
42
  ITCL_CLASSNAME = ''.freeze
43
43
 
44
- (ITCL_OBJ_ID = ['itclobj'.freeze, TkUtil.untrust('00000')]).instance_eval{
44
+ (ITCL_OBJ_ID = ['itclobj'.freeze, '00000']).instance_eval{
45
45
  @mutex = Mutex.new
46
46
  def mutex; @mutex; end
47
47
  freeze
48
48
  }
49
- ITCL_OBJ_TBL = TkUtil.untrust({})
49
+ ITCL_OBJ_TBL = {}
50
50
 
51
51
  def initialize(*args)
52
52
  if (@klass = self.class::ITCL_CLASSNAME).empty?
@@ -147,7 +147,7 @@ module Tk
147
147
 
148
148
  ComponentID_TBL = TkCore::INTERP.create_table
149
149
 
150
- (Itk_Component_ID = ['itk:component'.freeze, TkUtil.untrust('00000')]).instance_eval{
150
+ (Itk_Component_ID = ['itk:component'.freeze, '00000']).instance_eval{
151
151
  @mutex = Mutex.new
152
152
  def mutex; @mutex; end
153
153
  freeze
@@ -360,18 +360,7 @@ module Tk
360
360
  end
361
361
  end
362
362
 
363
- #def bind(*args)
364
- # unless @widget
365
- # begin
366
- # @widget = window(tk_call(@master, 'component', @component))
367
- # @path = @widget.path
368
- # rescue
369
- # fail RuntimeError, 'component is not assigned to a widget'
370
- # end
371
- # end
372
- # @widget.bind(*args)
373
- #end
374
- def bind(context, *args)
363
+ def bind(context, *args, &block)
375
364
  unless @widget
376
365
  begin
377
366
  @widget = window(tk_call(@master, 'component', @component))
@@ -381,26 +370,15 @@ module Tk
381
370
  end
382
371
  end
383
372
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
384
- if TkComm._callback_entry?(args[0]) || !block_given?
373
+ if TkComm._callback_entry?(args[0]) || !block
385
374
  cmd = args.shift
386
375
  else
387
- cmd = Proc.new
376
+ cmd = block
388
377
  end
389
378
  @widget.bind(context, cmd, *args)
390
379
  end
391
380
 
392
- #def bind_append(*args)
393
- # unless @widget
394
- # begin
395
- # @widget = window(tk_call(@master, 'component', @component))
396
- # @path = @widget.path
397
- # rescue
398
- # fail RuntimeError, 'component is not assigned to a widget'
399
- # end
400
- # end
401
- # @widget.bind_append(*args)
402
- #end
403
- def bind_append(context, *args)
381
+ def bind_append(context, *args, &block)
404
382
  unless @widget
405
383
  begin
406
384
  @widget = window(tk_call(@master, 'component', @component))
@@ -410,10 +388,10 @@ module Tk
410
388
  end
411
389
  end
412
390
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
413
- if TkComm._callback_entry?(args[0]) || !block_given?
391
+ if TkComm._callback_entry?(args[0]) || !block
414
392
  cmd = args.shift
415
393
  else
416
- cmd = Proc.new
394
+ cmd = block
417
395
  end
418
396
  @widget.bind_append(context, cmd, *args)
419
397
  end
@@ -76,10 +76,6 @@ class Tk::Iwidgets::Calendar
76
76
  # array of config-option key (string or symbol)
77
77
  ['command']
78
78
  end
79
-
80
- #def initialize(cmd = Proc.new, *args)
81
- # _initialize_for_cb_class(CalCmdArgs, cmd, *args)
82
- #end
83
79
  end
84
80
 
85
81
  def __validation_class_list
@@ -87,17 +83,6 @@ class Tk::Iwidgets::Calendar
87
83
  end
88
84
 
89
85
  Tk::ValidateConfigure.__def_validcmd(binding, CalendarCommand)
90
- =begin
91
- def command(cmd = Proc.new, args = nil)
92
- if cmd.kind_of?(CalendarCommand)
93
- configure('command', cmd)
94
- elsif args
95
- configure('command', [cmd, args])
96
- else
97
- configure('command', cmd)
98
- end
99
- end
100
- =end
101
86
 
102
87
  ####################################
103
88
 
@@ -75,27 +75,6 @@ class Tk::Iwidgets::Entryfield
75
75
  end
76
76
 
77
77
  Tk::ValidateConfigure.__def_validcmd(binding, EntryfieldValidate)
78
- =begin
79
- def validate(cmd = Proc.new, args = nil)
80
- if cmd.kind_of?(ValidateCmd)
81
- configure('validate', cmd)
82
- elsif args
83
- configure('validate', [cmd, args])
84
- else
85
- configure('validate', cmd)
86
- end
87
- end
88
-
89
- def invalid(cmd = Proc.new, args = nil)
90
- if cmd.kind_of?(ValidateCmd)
91
- configure('invalid', cmd)
92
- elsif args
93
- configure('invalid', [cmd, args])
94
- else
95
- configure('invalid', cmd)
96
- end
97
- end
98
- =end
99
78
 
100
79
  ####################################
101
80
 
@@ -112,7 +91,7 @@ class Tk::Iwidgets::Entryfield
112
91
  def value
113
92
  _fromUTF8(tk_send_without_enc('get'))
114
93
  end
115
- def value= (val)
94
+ def value=(val)
116
95
  tk_send_without_enc('delete', 0, 'end')
117
96
  tk_send_without_enc('insert', 0, _get_eval_enc_str(val))
118
97
  val
@@ -118,8 +118,8 @@ class Tk::Iwidgets::Notebook
118
118
  self
119
119
  end
120
120
 
121
- def scrollcommand(cmd=Proc.new)
122
- configure_cmd 'scrollcommand', cmd
121
+ def scrollcommand(cmd=nil, &block)
122
+ configure_cmd('scrollcommand', cmd || block)
123
123
  self
124
124
  end
125
125
  alias xscrollcommand scrollcommand
@@ -59,7 +59,7 @@ class Tk::Iwidgets::Promptdialog
59
59
  def value
60
60
  _fromUTF8(tk_send_without_enc('get'))
61
61
  end
62
- def value= (val)
62
+ def value=(val)
63
63
  tk_send_without_enc('delete', 0, 'end')
64
64
  tk_send_without_enc('insert', 0, _get_eval_enc_str(val))
65
65
  val
@@ -108,31 +108,23 @@ class Tk::Iwidgets::Scrolledcanvas
108
108
  *tags.collect{|t| tagid(t)}))
109
109
  end
110
110
 
111
- #def itembind(tag, context, cmd=Proc.new, *args)
112
- # _bind([path, "bind", tagid(tag)], context, cmd, *args)
113
- # self
114
- #end
115
- def itembind(tag, context, *args)
111
+ def itembind(tag, context, *args, &block)
116
112
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
117
- if TkComm._callback_entry?(args[0]) || !block_given?
113
+ if TkComm._callback_entry?(args[0]) || !block
118
114
  cmd = args.shift
119
115
  else
120
- cmd = Proc.new
116
+ cmd = block
121
117
  end
122
118
  _bind([path, "bind", tagid(tag)], context, cmd, *args)
123
119
  self
124
120
  end
125
121
 
126
- #def itembind_append(tag, context, cmd=Proc.new, *args)
127
- # _bind_append([path, "bind", tagid(tag)], context, cmd, *args)
128
- # self
129
- #end
130
- def itembind_append(tag, context, *args)
122
+ def itembind_append(tag, context, *args, &block)
131
123
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
132
- if TkComm._callback_entry?(args[0]) || !block_given?
124
+ if TkComm._callback_entry?(args[0]) || !block
133
125
  cmd = args.shift
134
126
  else
135
- cmd = Proc.new
127
+ cmd = block
136
128
  end
137
129
  _bind_append([path, "bind", tagid(tag)], context, cmd, *args)
138
130
  self
@@ -96,7 +96,7 @@ class Tk::Iwidgets::Spinner
96
96
  def value
97
97
  _fromUTF8(tk_send_without_enc('get'))
98
98
  end
99
- def value= (val)
99
+ def value=(val)
100
100
  tk_send_without_enc('delete', 0, 'end')
101
101
  tk_send_without_enc('insert', 0, _get_eval_enc_str(val))
102
102
  val
@@ -124,8 +124,8 @@ class Tk::Iwidgets::Tabnotebook
124
124
  self
125
125
  end
126
126
 
127
- def scrollcommand(cmd=Proc.new)
128
- configure_cmd 'scrollcommand', cmd
127
+ def scrollcommand(cmd=nil, &block)
128
+ configure_cmd('scrollcommand', cmd || block)
129
129
  self
130
130
  end
131
131
  alias xscrollcommand scrollcommand
@@ -106,7 +106,7 @@ class Tk::Iwidgets::Tabset
106
106
  return
107
107
  end
108
108
 
109
- reutrn unless @canvas ||= self.winfo_children[0]
109
+ return unless @canvas ||= self.winfo_children[0]
110
110
 
111
111
  delta = 1 if (delta = cget(:gap)) == 'overlap' ||
112
112
  (delta = self.winfo_pixels(delta) + 1) <= 0
@@ -132,7 +132,7 @@ def check_pkg(file, verbose=false)
132
132
  unless ver.kind_of?(String)
133
133
  begin
134
134
  ver = TkPackage.require(name)
135
- sccess_list[name] = ver
135
+ success_list[name] = ver
136
136
  rescue
137
137
  end
138
138
  end
@@ -76,10 +76,10 @@ class << Tk::Tcllib::Crosshair
76
76
  private :itemcget_tkstring, :itemcget, :itemcget_strict
77
77
  private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
78
78
 
79
- def confugure(w, slot, value=None)
79
+ def configure(w, slot, value=None)
80
80
  itemconfigure(w, slot, value)
81
81
  end
82
- def confuginfo(w, slot = nil)
82
+ def configinfo(w, slot = nil)
83
83
  itemconfiginfo(w, slot)
84
84
  end
85
85
  def current_configinfo(w, slot = nil)
@@ -150,8 +150,8 @@ class Tk::Tcllib::CText
150
150
  tk_call('ctext::findPreviousSpace', @path, idx)
151
151
  end
152
152
 
153
- def set_update_proc(cmd=Proc.new)
154
- tk_call('proc', 'ctext::update', '', cmd)
153
+ def set_update_proc(cmd=nil, &block)
154
+ tk_call('proc', 'ctext::update', '', cmd || block)
155
155
  self
156
156
  end
157
157
 
@@ -709,15 +709,15 @@ module Tk::Tcllib::Plotchart
709
709
  end
710
710
  private :_create_chart
711
711
 
712
- def plot_function(cmd=Proc.new)
713
- Tk.ip_eval("proc #{@path}_#{@chart} {x y} {#{install_cmd(cmd)} $x $y}")
712
+ def plot_function(cmd=nil, &block)
713
+ Tk.ip_eval("proc #{@path}_#{@chart} {x y} {#{install_cmd(cmd || block)} $x $y}")
714
714
  tk_call_without_enc(@chart, 'plotfunc', "#{@path}_#{@chart}")
715
715
  self
716
716
  end
717
717
 
718
- def plot_funcont(conts, cmd=Proc.new)
718
+ def plot_funcont(conts, cmd=nil, &block)
719
719
  conts = array2tk_list(conts) if conts.kind_of?(Array)
720
- Tk.ip_eval("proc #{@path}_#{@chart} {x y} {#{install_cmd(cmd)} $x $y}")
720
+ Tk.ip_eval("proc #{@path}_#{@chart} {x y} {#{install_cmd(cmd || block)} $x $y}")
721
721
  tk_call_without_enc(@chart, 'plotfuncont', "#{@path}_#{@chart}", conts)
722
722
  self
723
723
  end
@@ -1360,7 +1360,7 @@ module Tk::Tcllib::Plotchart
1360
1360
  class PlotSeries < TkObject
1361
1361
  SeriesID_TBL = TkCore::INTERP.create_table
1362
1362
 
1363
- (Series_ID = ['series'.freeze, TkUtil.untrust('00000')]).instance_eval{
1363
+ (Series_ID = ['series'.freeze, '00000']).instance_eval{
1364
1364
  @mutex = Mutex.new
1365
1365
  def mutex; @mutex; end
1366
1366
  freeze
@@ -212,7 +212,7 @@ class Tk::Tcllib::Tablelist
212
212
  nil
213
213
  else # cmd
214
214
  tk_tcl2ruby(cmd)
215
- end
215
+ end
216
216
  })
217
217
  end
218
218
  private :__val2ruby_optkeys
@@ -888,12 +888,12 @@ class Tk::Tcllib::Tablelist
888
888
  end
889
889
 
890
890
  def sortcolumn
891
- idx = num_or_str(tk_send('sortcolum'))
891
+ idx = num_or_str(tk_send('sortcolumn'))
892
892
  (idx.kind_of?(Fixnum) && idx < 0)? nil: idx
893
893
  end
894
894
 
895
895
  def sortcolumnlist
896
- simplelist(tk_send('sortcolumlist')).map{|col| num_or_str(col)}
896
+ simplelist(tk_send('sortcolumnlist')).map{|col| num_or_str(col)}
897
897
  end
898
898
 
899
899
  def sortorder
@@ -33,8 +33,8 @@ end
33
33
  module Tk::Tcllib::Validator
34
34
  extend TkCore
35
35
 
36
- def self.attach(widget, color, cmd=Proc.new)
37
- tk_call_without_enc('::widget::validator', 'attach', widget, color, cmd)
36
+ def self.attach(widget, color, cmd=nil, &block)
37
+ tk_call_without_enc('::widget::validator', 'attach', widget, color, cmd || block)
38
38
  nil
39
39
  end
40
40
 
@@ -48,17 +48,17 @@ module Tk::Tcllib::Validator
48
48
  nil
49
49
  end
50
50
 
51
- def attach_validator(color, cmd=Proc.new)
52
- tk_call_without_enc('::widget::validator', 'attach', @path, color, cmd)
51
+ def attach_validator(color, cmd=nil, &block)
52
+ tk_call_without_enc('::widget::validator', 'attach', @path, color, cmd || block)
53
53
  self
54
54
  end
55
55
 
56
- def detach_validator(color, cmd=Proc.new)
56
+ def detach_validator(color, cmd=nil)
57
57
  tk_call_without_enc('::widget::validator', 'detach', @path)
58
58
  self
59
59
  end
60
60
 
61
- def invoke_validator(color, cmd=Proc.new)
61
+ def invoke_validator(color, cmd=nil)
62
62
  tk_call_without_enc('::widget::validator', 'validate', @path)
63
63
  self
64
64
  end
data/lib/tkextlib/tile.rb CHANGED
@@ -144,7 +144,6 @@ module Tk
144
144
  # Tcl/Tk interpreter working under Ruby/Tk.
145
145
  # Please give attention to use this method. It may conflict with
146
146
  # some definitions on Tcl/Tk scripts.
147
- klass_name = self.name
148
147
  proc_name = 'LoadImages'
149
148
  if Tk::Tile::USE_TTK_NAMESPACE
150
149
  ns_list = ['::tile']
@@ -338,7 +337,7 @@ module Tk
338
337
  if script
339
338
  tk_send('instate', state, script)
340
339
  elsif b
341
- tk_send('instate', state, Proc.new(&b))
340
+ tk_send('instate', state, b)
342
341
  else
343
342
  bool(tk_send('instate', state))
344
343
  end
@@ -320,7 +320,7 @@ class << Tk::Tile::Style
320
320
 
321
321
  def theme_settings(name, cmd=nil, &b)
322
322
  name = name.to_s
323
- cmd = Proc.new(&b) if !cmd && b
323
+ cmd = b if !cmd && b
324
324
  tk_call(TkCommandNames[0], 'theme', 'settings', name, cmd)
325
325
  name
326
326
  end
@@ -32,7 +32,7 @@ module Tk::Tile::TreeviewConfig
32
32
  if slot
33
33
  slot = slot.to_s
34
34
 
35
- alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
35
+ _, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
36
36
  if real_name
37
37
  slot = real_name.to_s
38
38
  end
@@ -203,7 +203,7 @@ module Tk::Tile::TreeviewConfig
203
203
  if slot
204
204
  slot = slot.to_s
205
205
 
206
- alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
206
+ _, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
207
207
  if real_name
208
208
  slot = real_name.to_s
209
209
  end
@@ -939,7 +939,7 @@ class Tk::Tile::Treeview::Tag < TkObject
939
939
 
940
940
  TagID_TBL = TkCore::INTERP.create_table
941
941
 
942
- (Tag_ID = ['tile_treeview_tag'.freeze, TkUtil.untrust('00000')]).instance_eval{
942
+ (Tag_ID = ['tile_treeview_tag'.freeze, '00000']).instance_eval{
943
943
  @mutex = Mutex.new
944
944
  def mutex; @mutex; end
945
945
  freeze
@@ -999,21 +999,21 @@ class Tk::Tile::Treeview::Tag < TkObject
999
999
  @t.tag_remove(@id, *items)
1000
1000
  end
1001
1001
 
1002
- def bind(seq, *args)
1003
- if TkComm._callback_entry?(args[0]) || !block_given?
1002
+ def bind(seq, *args, &block)
1003
+ if TkComm._callback_entry?(args[0]) || !block
1004
1004
  cmd = args.shift
1005
1005
  else
1006
- cmd = Proc.new
1006
+ cmd = block
1007
1007
  end
1008
1008
  @t.tag_bind(@id, seq, cmd, *args)
1009
1009
  self
1010
1010
  end
1011
1011
 
1012
- def bind_append(seq, *args)
1013
- if TkComm._callback_entry?(args[0]) || !block_given?
1012
+ def bind_append(seq, *args, &block)
1013
+ if TkComm._callback_entry?(args[0]) || !block
1014
1014
  cmd = args.shift
1015
1015
  else
1016
- cmd = Proc.new
1016
+ cmd = block
1017
1017
  end
1018
1018
  @t.tag_bind_append(@id, seq, cmd, *args)
1019
1019
  self
@@ -1191,13 +1191,6 @@ class Tk::Tile::Treeview < TkWindow
1191
1191
  Tk::Tile::Treeview::Item.new(self, parent, idx, keys)
1192
1192
  end
1193
1193
 
1194
- # def instate(spec, cmd=Proc.new)
1195
- # tk_send('instate', spec, cmd)
1196
- # end
1197
- # def state(spec=None)
1198
- # tk_send('state', spec)
1199
- # end
1200
-
1201
1194
  def move(item, parent, idx)
1202
1195
  tk_send('move', item, parent, idx)
1203
1196
  self
@@ -1280,22 +1273,22 @@ class Tk::Tile::Treeview < TkWindow
1280
1273
  }
1281
1274
  end
1282
1275
 
1283
- def tag_bind(tag, seq, *args)
1284
- if TkComm._callback_entry?(args[0]) || !block_given?
1276
+ def tag_bind(tag, seq, *args, &block)
1277
+ if TkComm._callback_entry?(args[0]) || !block
1285
1278
  cmd = args.shift
1286
1279
  else
1287
- cmd = Proc.new
1280
+ cmd = block
1288
1281
  end
1289
1282
  _bind([@path, 'tag', 'bind', tag], seq, cmd, *args)
1290
1283
  self
1291
1284
  end
1292
1285
  alias tagbind tag_bind
1293
1286
 
1294
- def tag_bind_append(tag, seq, *args)
1295
- if TkComm._callback_entry?(args[0]) || !block_given?
1287
+ def tag_bind_append(tag, seq, *args, &block)
1288
+ if TkComm._callback_entry?(args[0]) || !block
1296
1289
  cmd = args.shift
1297
1290
  else
1298
- cmd = Proc.new
1291
+ cmd = block
1299
1292
  end
1300
1293
  _bind_append([@path, 'tag', 'bind', tag], seq, cmd, *args)
1301
1294
  self