tk-win 0.2.0-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +17 -0
  5. data/Rakefile +46 -0
  6. data/VERSION +1 -0
  7. data/lib/tcltk.rb +367 -0
  8. data/lib/tk.rb +5682 -0
  9. data/lib/tk/after.rb +6 -0
  10. data/lib/tk/autoload.rb +760 -0
  11. data/lib/tk/bgerror.rb +29 -0
  12. data/lib/tk/bindtag.rb +138 -0
  13. data/lib/tk/button.rb +31 -0
  14. data/lib/tk/canvas.rb +816 -0
  15. data/lib/tk/canvastag.rb +459 -0
  16. data/lib/tk/checkbutton.rb +32 -0
  17. data/lib/tk/clipboard.rb +75 -0
  18. data/lib/tk/clock.rb +71 -0
  19. data/lib/tk/composite.rb +484 -0
  20. data/lib/tk/console.rb +52 -0
  21. data/lib/tk/dialog.rb +326 -0
  22. data/lib/tk/encodedstr.rb +187 -0
  23. data/lib/tk/entry.rb +120 -0
  24. data/lib/tk/event.rb +562 -0
  25. data/lib/tk/font.rb +2351 -0
  26. data/lib/tk/frame.rb +132 -0
  27. data/lib/tk/grid.rb +279 -0
  28. data/lib/tk/image.rb +275 -0
  29. data/lib/tk/itemconfig.rb +1222 -0
  30. data/lib/tk/itemfont.rb +327 -0
  31. data/lib/tk/kinput.rb +71 -0
  32. data/lib/tk/label.rb +22 -0
  33. data/lib/tk/labelframe.rb +31 -0
  34. data/lib/tk/listbox.rb +284 -0
  35. data/lib/tk/macpkg.rb +80 -0
  36. data/lib/tk/menu.rb +718 -0
  37. data/lib/tk/menubar.rb +137 -0
  38. data/lib/tk/menuspec.rb +456 -0
  39. data/lib/tk/message.rb +24 -0
  40. data/lib/tk/mngfocus.rb +33 -0
  41. data/lib/tk/msgcat.rb +296 -0
  42. data/lib/tk/namespace.rb +551 -0
  43. data/lib/tk/optiondb.rb +377 -0
  44. data/lib/tk/optionobj.rb +212 -0
  45. data/lib/tk/pack.rb +107 -0
  46. data/lib/tk/package.rb +143 -0
  47. data/lib/tk/palette.rb +55 -0
  48. data/lib/tk/panedwindow.rb +260 -0
  49. data/lib/tk/place.rb +128 -0
  50. data/lib/tk/radiobutton.rb +73 -0
  51. data/lib/tk/root.rb +95 -0
  52. data/lib/tk/scale.rb +112 -0
  53. data/lib/tk/scrollable.rb +82 -0
  54. data/lib/tk/scrollbar.rb +183 -0
  55. data/lib/tk/scrollbox.rb +39 -0
  56. data/lib/tk/selection.rb +86 -0
  57. data/lib/tk/spinbox.rb +144 -0
  58. data/lib/tk/tagfont.rb +43 -0
  59. data/lib/tk/text.rb +1604 -0
  60. data/lib/tk/textimage.rb +88 -0
  61. data/lib/tk/textmark.rb +204 -0
  62. data/lib/tk/texttag.rb +321 -0
  63. data/lib/tk/textwindow.rb +154 -0
  64. data/lib/tk/timer.rb +669 -0
  65. data/lib/tk/toplevel.rb +264 -0
  66. data/lib/tk/ttk_selector.rb +98 -0
  67. data/lib/tk/txtwin_abst.rb +39 -0
  68. data/lib/tk/validation.rb +397 -0
  69. data/lib/tk/variable.rb +1799 -0
  70. data/lib/tk/virtevent.rb +139 -0
  71. data/lib/tk/winfo.rb +392 -0
  72. data/lib/tk/winpkg.rb +156 -0
  73. data/lib/tk/wm.rb +552 -0
  74. data/lib/tk/xim.rb +122 -0
  75. data/lib/tkafter.rb +4 -0
  76. data/lib/tkbgerror.rb +4 -0
  77. data/lib/tkcanvas.rb +4 -0
  78. data/lib/tkclass.rb +47 -0
  79. data/lib/tkconsole.rb +4 -0
  80. data/lib/tkdialog.rb +4 -0
  81. data/lib/tkentry.rb +4 -0
  82. data/lib/tkextlib/ICONS.rb +13 -0
  83. data/lib/tkextlib/ICONS/icons.rb +129 -0
  84. data/lib/tkextlib/ICONS/setup.rb +8 -0
  85. data/lib/tkextlib/SUPPORT_STATUS +198 -0
  86. data/lib/tkextlib/blt.rb +189 -0
  87. data/lib/tkextlib/blt/barchart.rb +79 -0
  88. data/lib/tkextlib/blt/bitmap.rb +112 -0
  89. data/lib/tkextlib/blt/busy.rb +83 -0
  90. data/lib/tkextlib/blt/component.rb +2218 -0
  91. data/lib/tkextlib/blt/container.rb +28 -0
  92. data/lib/tkextlib/blt/cutbuffer.rb +23 -0
  93. data/lib/tkextlib/blt/dragdrop.rb +269 -0
  94. data/lib/tkextlib/blt/eps.rb +32 -0
  95. data/lib/tkextlib/blt/graph.rb +67 -0
  96. data/lib/tkextlib/blt/htext.rb +112 -0
  97. data/lib/tkextlib/blt/setup.rb +8 -0
  98. data/lib/tkextlib/blt/spline.rb +23 -0
  99. data/lib/tkextlib/blt/stripchart.rb +74 -0
  100. data/lib/tkextlib/blt/table.rb +412 -0
  101. data/lib/tkextlib/blt/tabnotebook.rb +110 -0
  102. data/lib/tkextlib/blt/tabset.rb +504 -0
  103. data/lib/tkextlib/blt/ted.rb +68 -0
  104. data/lib/tkextlib/blt/tile.rb +25 -0
  105. data/lib/tkextlib/blt/tile/button.rb +16 -0
  106. data/lib/tkextlib/blt/tile/checkbutton.rb +17 -0
  107. data/lib/tkextlib/blt/tile/frame.rb +16 -0
  108. data/lib/tkextlib/blt/tile/label.rb +16 -0
  109. data/lib/tkextlib/blt/tile/radiobutton.rb +17 -0
  110. data/lib/tkextlib/blt/tile/scrollbar.rb +16 -0
  111. data/lib/tkextlib/blt/tile/toplevel.rb +16 -0
  112. data/lib/tkextlib/blt/tree.rb +1058 -0
  113. data/lib/tkextlib/blt/treeview.rb +1287 -0
  114. data/lib/tkextlib/blt/unix_dnd.rb +141 -0
  115. data/lib/tkextlib/blt/vector.rb +256 -0
  116. data/lib/tkextlib/blt/watch.rb +175 -0
  117. data/lib/tkextlib/blt/win_printer.rb +61 -0
  118. data/lib/tkextlib/blt/winop.rb +107 -0
  119. data/lib/tkextlib/bwidget.rb +153 -0
  120. data/lib/tkextlib/bwidget/arrowbutton.rb +21 -0
  121. data/lib/tkextlib/bwidget/bitmap.rb +21 -0
  122. data/lib/tkextlib/bwidget/button.rb +31 -0
  123. data/lib/tkextlib/bwidget/buttonbox.rb +90 -0
  124. data/lib/tkextlib/bwidget/combobox.rb +62 -0
  125. data/lib/tkextlib/bwidget/dialog.rb +194 -0
  126. data/lib/tkextlib/bwidget/dragsite.rb +31 -0
  127. data/lib/tkextlib/bwidget/dropsite.rb +39 -0
  128. data/lib/tkextlib/bwidget/dynamichelp.rb +63 -0
  129. data/lib/tkextlib/bwidget/entry.rb +43 -0
  130. data/lib/tkextlib/bwidget/label.rb +41 -0
  131. data/lib/tkextlib/bwidget/labelentry.rb +80 -0
  132. data/lib/tkextlib/bwidget/labelframe.rb +52 -0
  133. data/lib/tkextlib/bwidget/listbox.rb +361 -0
  134. data/lib/tkextlib/bwidget/mainframe.rb +132 -0
  135. data/lib/tkextlib/bwidget/messagedlg.rb +192 -0
  136. data/lib/tkextlib/bwidget/notebook.rb +166 -0
  137. data/lib/tkextlib/bwidget/pagesmanager.rb +73 -0
  138. data/lib/tkextlib/bwidget/panedwindow.rb +42 -0
  139. data/lib/tkextlib/bwidget/panelframe.rb +67 -0
  140. data/lib/tkextlib/bwidget/passwddlg.rb +44 -0
  141. data/lib/tkextlib/bwidget/progressbar.rb +20 -0
  142. data/lib/tkextlib/bwidget/progressdlg.rb +58 -0
  143. data/lib/tkextlib/bwidget/scrollableframe.rb +40 -0
  144. data/lib/tkextlib/bwidget/scrolledwindow.rb +48 -0
  145. data/lib/tkextlib/bwidget/scrollview.rb +25 -0
  146. data/lib/tkextlib/bwidget/selectcolor.rb +73 -0
  147. data/lib/tkextlib/bwidget/selectfont.rb +91 -0
  148. data/lib/tkextlib/bwidget/separator.rb +20 -0
  149. data/lib/tkextlib/bwidget/setup.rb +8 -0
  150. data/lib/tkextlib/bwidget/spinbox.rb +98 -0
  151. data/lib/tkextlib/bwidget/statusbar.rb +62 -0
  152. data/lib/tkextlib/bwidget/titleframe.rb +33 -0
  153. data/lib/tkextlib/bwidget/tree.rb +500 -0
  154. data/lib/tkextlib/bwidget/widget.rb +129 -0
  155. data/lib/tkextlib/itcl.rb +13 -0
  156. data/lib/tkextlib/itcl/incr_tcl.rb +178 -0
  157. data/lib/tkextlib/itcl/setup.rb +13 -0
  158. data/lib/tkextlib/itk.rb +13 -0
  159. data/lib/tkextlib/itk/incr_tk.rb +446 -0
  160. data/lib/tkextlib/itk/setup.rb +13 -0
  161. data/lib/tkextlib/iwidgets.rb +94 -0
  162. data/lib/tkextlib/iwidgets/buttonbox.rb +121 -0
  163. data/lib/tkextlib/iwidgets/calendar.rb +125 -0
  164. data/lib/tkextlib/iwidgets/canvasprintbox.rb +53 -0
  165. data/lib/tkextlib/iwidgets/canvasprintdialog.rb +38 -0
  166. data/lib/tkextlib/iwidgets/checkbox.rb +130 -0
  167. data/lib/tkextlib/iwidgets/combobox.rb +104 -0
  168. data/lib/tkextlib/iwidgets/dateentry.rb +20 -0
  169. data/lib/tkextlib/iwidgets/datefield.rb +58 -0
  170. data/lib/tkextlib/iwidgets/dialog.rb +20 -0
  171. data/lib/tkextlib/iwidgets/dialogshell.rb +121 -0
  172. data/lib/tkextlib/iwidgets/disjointlistbox.rb +50 -0
  173. data/lib/tkextlib/iwidgets/entryfield.rb +185 -0
  174. data/lib/tkextlib/iwidgets/extbutton.rb +40 -0
  175. data/lib/tkextlib/iwidgets/extfileselectionbox.rb +46 -0
  176. data/lib/tkextlib/iwidgets/extfileselectiondialog.rb +33 -0
  177. data/lib/tkextlib/iwidgets/feedback.rb +35 -0
  178. data/lib/tkextlib/iwidgets/fileselectionbox.rb +46 -0
  179. data/lib/tkextlib/iwidgets/fileselectiondialog.rb +33 -0
  180. data/lib/tkextlib/iwidgets/finddialog.rb +42 -0
  181. data/lib/tkextlib/iwidgets/hierarchy.rb +365 -0
  182. data/lib/tkextlib/iwidgets/hyperhelp.rb +50 -0
  183. data/lib/tkextlib/iwidgets/labeledframe.rb +39 -0
  184. data/lib/tkextlib/iwidgets/labeledwidget.rb +45 -0
  185. data/lib/tkextlib/iwidgets/mainwindow.rb +67 -0
  186. data/lib/tkextlib/iwidgets/menubar.rb +212 -0
  187. data/lib/tkextlib/iwidgets/messagebox.rb +93 -0
  188. data/lib/tkextlib/iwidgets/messagedialog.rb +20 -0
  189. data/lib/tkextlib/iwidgets/notebook.rb +175 -0
  190. data/lib/tkextlib/iwidgets/optionmenu.rb +92 -0
  191. data/lib/tkextlib/iwidgets/panedwindow.rb +134 -0
  192. data/lib/tkextlib/iwidgets/promptdialog.rb +131 -0
  193. data/lib/tkextlib/iwidgets/pushbutton.rb +35 -0
  194. data/lib/tkextlib/iwidgets/radiobox.rb +121 -0
  195. data/lib/tkextlib/iwidgets/scopedobject.rb +24 -0
  196. data/lib/tkextlib/iwidgets/scrolledcanvas.rb +353 -0
  197. data/lib/tkextlib/iwidgets/scrolledframe.rb +59 -0
  198. data/lib/tkextlib/iwidgets/scrolledhtml.rb +58 -0
  199. data/lib/tkextlib/iwidgets/scrolledlistbox.rb +207 -0
  200. data/lib/tkextlib/iwidgets/scrolledtext.rb +568 -0
  201. data/lib/tkextlib/iwidgets/scrolledwidget.rb +20 -0
  202. data/lib/tkextlib/iwidgets/selectionbox.rb +102 -0
  203. data/lib/tkextlib/iwidgets/selectiondialog.rb +92 -0
  204. data/lib/tkextlib/iwidgets/setup.rb +8 -0
  205. data/lib/tkextlib/iwidgets/shell.rb +38 -0
  206. data/lib/tkextlib/iwidgets/spindate.rb +48 -0
  207. data/lib/tkextlib/iwidgets/spinint.rb +30 -0
  208. data/lib/tkextlib/iwidgets/spinner.rb +169 -0
  209. data/lib/tkextlib/iwidgets/spintime.rb +48 -0
  210. data/lib/tkextlib/iwidgets/tabnotebook.rb +181 -0
  211. data/lib/tkextlib/iwidgets/tabset.rb +145 -0
  212. data/lib/tkextlib/iwidgets/timeentry.rb +25 -0
  213. data/lib/tkextlib/iwidgets/timefield.rb +58 -0
  214. data/lib/tkextlib/iwidgets/toolbar.rb +112 -0
  215. data/lib/tkextlib/iwidgets/watch.rb +56 -0
  216. data/lib/tkextlib/pkg_checker.rb +184 -0
  217. data/lib/tkextlib/setup.rb +8 -0
  218. data/lib/tkextlib/tcllib.rb +105 -0
  219. data/lib/tkextlib/tcllib/autoscroll.rb +158 -0
  220. data/lib/tkextlib/tcllib/ctext.rb +160 -0
  221. data/lib/tkextlib/tcllib/cursor.rb +97 -0
  222. data/lib/tkextlib/tcllib/datefield.rb +57 -0
  223. data/lib/tkextlib/tcllib/dialog.rb +84 -0
  224. data/lib/tkextlib/tcllib/getstring.rb +134 -0
  225. data/lib/tkextlib/tcllib/history.rb +73 -0
  226. data/lib/tkextlib/tcllib/ico.rb +146 -0
  227. data/lib/tkextlib/tcllib/ip_entry.rb +75 -0
  228. data/lib/tkextlib/tcllib/panelframe.rb +78 -0
  229. data/lib/tkextlib/tcllib/plotchart.rb +1404 -0
  230. data/lib/tkextlib/tcllib/ruler.rb +65 -0
  231. data/lib/tkextlib/tcllib/screenruler.rb +68 -0
  232. data/lib/tkextlib/tcllib/scrollwin.rb +61 -0
  233. data/lib/tkextlib/tcllib/setup.rb +8 -0
  234. data/lib/tkextlib/tcllib/style.rb +61 -0
  235. data/lib/tkextlib/tcllib/superframe.rb +51 -0
  236. data/lib/tkextlib/tcllib/swaplist.rb +150 -0
  237. data/lib/tkextlib/tcllib/tablelist.rb +28 -0
  238. data/lib/tkextlib/tcllib/tablelist_core.rb +1072 -0
  239. data/lib/tkextlib/tcllib/tablelist_tile.rb +43 -0
  240. data/lib/tkextlib/tcllib/tkpiechart.rb +314 -0
  241. data/lib/tkextlib/tcllib/tooltip.rb +104 -0
  242. data/lib/tkextlib/tcllib/widget.rb +82 -0
  243. data/lib/tkextlib/tclx.rb +13 -0
  244. data/lib/tkextlib/tclx/setup.rb +8 -0
  245. data/lib/tkextlib/tclx/tclx.rb +74 -0
  246. data/lib/tkextlib/tile.rb +449 -0
  247. data/lib/tkextlib/tile/dialog.rb +102 -0
  248. data/lib/tkextlib/tile/setup.rb +8 -0
  249. data/lib/tkextlib/tile/sizegrip.rb +32 -0
  250. data/lib/tkextlib/tile/style.rb +336 -0
  251. data/lib/tkextlib/tile/tbutton.rb +34 -0
  252. data/lib/tkextlib/tile/tcheckbutton.rb +38 -0
  253. data/lib/tkextlib/tile/tcombobox.rb +55 -0
  254. data/lib/tkextlib/tile/tentry.rb +49 -0
  255. data/lib/tkextlib/tile/tframe.rb +34 -0
  256. data/lib/tkextlib/tile/tlabel.rb +34 -0
  257. data/lib/tkextlib/tile/tlabelframe.rb +38 -0
  258. data/lib/tkextlib/tile/tmenubutton.rb +38 -0
  259. data/lib/tkextlib/tile/tnotebook.rb +147 -0
  260. data/lib/tkextlib/tile/tpaned.rb +245 -0
  261. data/lib/tkextlib/tile/tprogressbar.rb +57 -0
  262. data/lib/tkextlib/tile/tradiobutton.rb +38 -0
  263. data/lib/tkextlib/tile/treeview.rb +1306 -0
  264. data/lib/tkextlib/tile/tscale.rb +56 -0
  265. data/lib/tkextlib/tile/tscrollbar.rb +63 -0
  266. data/lib/tkextlib/tile/tseparator.rb +34 -0
  267. data/lib/tkextlib/tile/tsquare.rb +30 -0
  268. data/lib/tkextlib/tkDND.rb +18 -0
  269. data/lib/tkextlib/tkDND/setup.rb +8 -0
  270. data/lib/tkextlib/tkDND/shape.rb +125 -0
  271. data/lib/tkextlib/tkDND/tkdnd.rb +182 -0
  272. data/lib/tkextlib/tkHTML.rb +13 -0
  273. data/lib/tkextlib/tkHTML/htmlwidget.rb +453 -0
  274. data/lib/tkextlib/tkHTML/setup.rb +8 -0
  275. data/lib/tkextlib/tkimg.rb +36 -0
  276. data/lib/tkextlib/tkimg/bmp.rb +33 -0
  277. data/lib/tkextlib/tkimg/gif.rb +33 -0
  278. data/lib/tkextlib/tkimg/ico.rb +33 -0
  279. data/lib/tkextlib/tkimg/jpeg.rb +33 -0
  280. data/lib/tkextlib/tkimg/pcx.rb +33 -0
  281. data/lib/tkextlib/tkimg/pixmap.rb +44 -0
  282. data/lib/tkextlib/tkimg/png.rb +33 -0
  283. data/lib/tkextlib/tkimg/ppm.rb +33 -0
  284. data/lib/tkextlib/tkimg/ps.rb +33 -0
  285. data/lib/tkextlib/tkimg/setup.rb +8 -0
  286. data/lib/tkextlib/tkimg/sgi.rb +33 -0
  287. data/lib/tkextlib/tkimg/sun.rb +33 -0
  288. data/lib/tkextlib/tkimg/tga.rb +33 -0
  289. data/lib/tkextlib/tkimg/tiff.rb +33 -0
  290. data/lib/tkextlib/tkimg/window.rb +33 -0
  291. data/lib/tkextlib/tkimg/xbm.rb +33 -0
  292. data/lib/tkextlib/tkimg/xpm.rb +33 -0
  293. data/lib/tkextlib/tktable.rb +14 -0
  294. data/lib/tkextlib/tktable/setup.rb +8 -0
  295. data/lib/tkextlib/tktable/tktable.rb +966 -0
  296. data/lib/tkextlib/tktrans.rb +14 -0
  297. data/lib/tkextlib/tktrans/setup.rb +8 -0
  298. data/lib/tkextlib/tktrans/tktrans.rb +64 -0
  299. data/lib/tkextlib/treectrl.rb +13 -0
  300. data/lib/tkextlib/treectrl/setup.rb +8 -0
  301. data/lib/tkextlib/treectrl/tktreectrl.rb +2522 -0
  302. data/lib/tkextlib/trofs.rb +13 -0
  303. data/lib/tkextlib/trofs/setup.rb +8 -0
  304. data/lib/tkextlib/trofs/trofs.rb +51 -0
  305. data/lib/tkextlib/version.rb +6 -0
  306. data/lib/tkextlib/vu.rb +48 -0
  307. data/lib/tkextlib/vu/bargraph.rb +61 -0
  308. data/lib/tkextlib/vu/charts.rb +53 -0
  309. data/lib/tkextlib/vu/dial.rb +102 -0
  310. data/lib/tkextlib/vu/pie.rb +286 -0
  311. data/lib/tkextlib/vu/setup.rb +8 -0
  312. data/lib/tkextlib/vu/spinbox.rb +22 -0
  313. data/lib/tkextlib/winico.rb +14 -0
  314. data/lib/tkextlib/winico/setup.rb +8 -0
  315. data/lib/tkextlib/winico/winico.rb +224 -0
  316. data/lib/tkfont.rb +4 -0
  317. data/lib/tkmacpkg.rb +4 -0
  318. data/lib/tkmenubar.rb +4 -0
  319. data/lib/tkmngfocus.rb +4 -0
  320. data/lib/tkpalette.rb +4 -0
  321. data/lib/tkscrollbox.rb +4 -0
  322. data/lib/tktext.rb +4 -0
  323. data/lib/tkvirtevent.rb +4 -0
  324. data/lib/tkwinpkg.rb +4 -0
  325. data/spec/spec.opts +1 -0
  326. data/spec/spec_helper.rb +9 -0
  327. data/spec/tk-win_spec.rb +7 -0
  328. data/tk-win.gemspec +373 -0
  329. metadata +412 -0
@@ -0,0 +1,120 @@
1
+ #
2
+ # tk/entry.rb - Tk entry classes
3
+ # by Yukihiro Matsumoto <matz@caelum.co.jp>
4
+
5
+ require 'tk'
6
+ require 'tk/label'
7
+ require 'tk/scrollable'
8
+ require 'tk/validation'
9
+
10
+ class Tk::Entry<Tk::Label
11
+ include X_Scrollable
12
+ include TkValidation
13
+
14
+ TkCommandNames = ['entry'.freeze].freeze
15
+ WidgetClassName = 'Entry'.freeze
16
+ WidgetClassNames[WidgetClassName] ||= self
17
+
18
+ #def create_self(keys)
19
+ # super(__conv_vcmd_on_hash_kv(keys))
20
+ #end
21
+ #private :create_self
22
+
23
+ def __strval_optkeys
24
+ super() + ['show', 'disabledbackground', 'readonlybackground']
25
+ end
26
+ private :__strval_optkeys
27
+
28
+ def bbox(index)
29
+ list(tk_send_without_enc('bbox', index))
30
+ end
31
+ def cursor
32
+ number(tk_send_without_enc('index', 'insert'))
33
+ end
34
+ alias icursor cursor
35
+ def cursor=(index)
36
+ tk_send_without_enc('icursor', index)
37
+ #self
38
+ index
39
+ end
40
+ alias icursor= cursor=
41
+ def index(idx)
42
+ number(tk_send_without_enc('index', idx))
43
+ end
44
+ def insert(pos,text)
45
+ tk_send_without_enc('insert', pos, _get_eval_enc_str(text))
46
+ self
47
+ end
48
+ def delete(first, last=None)
49
+ tk_send_without_enc('delete', first, last)
50
+ self
51
+ end
52
+ def mark(pos)
53
+ tk_send_without_enc('scan', 'mark', pos)
54
+ self
55
+ end
56
+ def dragto(pos)
57
+ tk_send_without_enc('scan', 'dragto', pos)
58
+ self
59
+ end
60
+ def selection_adjust(index)
61
+ tk_send_without_enc('selection', 'adjust', index)
62
+ self
63
+ end
64
+ def selection_clear
65
+ tk_send_without_enc('selection', 'clear')
66
+ self
67
+ end
68
+ def selection_from(index)
69
+ tk_send_without_enc('selection', 'from', index)
70
+ self
71
+ end
72
+ def selection_present()
73
+ bool(tk_send_without_enc('selection', 'present'))
74
+ end
75
+ def selection_range(s, e)
76
+ tk_send_without_enc('selection', 'range', s, e)
77
+ self
78
+ end
79
+ def selection_to(index)
80
+ tk_send_without_enc('selection', 'to', index)
81
+ self
82
+ end
83
+
84
+ def invoke_validate
85
+ bool(tk_send_without_enc('validate'))
86
+ end
87
+ def validate(mode = nil)
88
+ if mode
89
+ configure 'validate', mode
90
+ else
91
+ invoke_validate
92
+ end
93
+ end
94
+
95
+ def value
96
+ _fromUTF8(tk_send_without_enc('get'))
97
+ end
98
+ def value= (val)
99
+ tk_send_without_enc('delete', 0, 'end')
100
+ tk_send_without_enc('insert', 0, _get_eval_enc_str(val))
101
+ val
102
+ end
103
+ alias get value
104
+ alias set value=
105
+
106
+ def [](*args)
107
+ self.value[*args]
108
+ end
109
+ def []=(*args)
110
+ val = args.pop
111
+ str = self.value
112
+ str[*args] = val
113
+ self.value = str
114
+ val
115
+ end
116
+ end
117
+
118
+ #TkEntry = Tk::Entry unless Object.const_defined? :TkEntry
119
+ #Tk.__set_toplevel_aliases__(:Tk, Tk::Entry, :TkEntry)
120
+ Tk.__set_loaded_toplevel_aliases__('tk/entry.rb', :Tk, Tk::Entry, :TkEntry)
@@ -0,0 +1,562 @@
1
+ #
2
+ # tk/event.rb - module for event
3
+ #
4
+
5
+ module TkEvent
6
+ end
7
+
8
+ ########################
9
+
10
+ require 'tkutil'
11
+ require 'tk' unless Object.const_defined? :TkComm
12
+
13
+ ########################
14
+
15
+ module TkEvent
16
+ class Event < TkUtil::CallbackSubst
17
+ module Grp
18
+ KEY = 0x1
19
+ BUTTON = 0x2
20
+ MOTION = 0x4
21
+ CROSSING = 0x8
22
+ FOCUS = 0x10
23
+ EXPOSE = 0x20
24
+ VISIBILITY = 0x40
25
+ CREATE = 0x80
26
+ DESTROY = 0x100
27
+ UNMAP = 0x200
28
+ MAP = 0x400
29
+ REPARENT = 0x800
30
+ CONFIG = 0x1000
31
+ GRAVITY = 0x2000
32
+ CIRC = 0x4000
33
+ PROP = 0x8000
34
+ COLORMAP = 0x10000
35
+ VIRTUAL = 0x20000
36
+ ACTIVATE = 0x40000
37
+ MAPREQ = 0x80000
38
+ CONFIGREQ = 0x100000
39
+ RESIZEREQ = 0x200000
40
+ CIRCREQ = 0x400000
41
+
42
+ MWHEEL = KEY
43
+
44
+ STRING_DATA = 0x80000000 # special flag for 'data' field
45
+
46
+ ALL = 0xFFFFFFFF
47
+
48
+ KEY_BUTTON_MOTION_VIRTUAL = (KEY|MWHEEL|BUTTON|MOTION|VIRTUAL)
49
+ KEY_BUTTON_MOTION_CROSSING = (KEY|MWHEEL|BUTTON|MOTION|CROSSING|VIRTUAL)
50
+ end
51
+
52
+ type_data = [
53
+ #-----+-------------------+------------------+-----------------------#
54
+ # ID | const | group_flag | context_name #
55
+ #-----+-------------------+------------------+-----------------------#
56
+ [ 2, :KeyPress, Grp::KEY, 'KeyPress', 'Key' ],
57
+ [ 3, :KeyRelease, Grp::KEY, 'KeyRelease' ],
58
+ [ 4, :ButtonPress, Grp::BUTTON, 'ButtonPress', 'Button' ],
59
+ [ 5, :ButtonRelease, Grp::BUTTON, 'ButtonRelease' ],
60
+ [ 6, :MotionNotify, Grp::MOTION, 'Motion' ],
61
+ [ 7, :EnterNotify, Grp::CROSSING, 'Enter' ],
62
+ [ 8, :LeaveNotify, Grp::CROSSING, 'Leave' ],
63
+ [ 9, :FocusIn, Grp::FOCUS, 'FocusIn' ],
64
+ [ 10, :FocusOut, Grp::FOCUS, 'FocusOut' ],
65
+ [ 11, :KeymapNotify, 0, ],
66
+ [ 12, :Expose, Grp::EXPOSE, 'Expose' ],
67
+ [ 13, :GraphicsExpose, Grp::EXPOSE, ],
68
+ [ 14, :NoExpose, 0, ],
69
+ [ 15, :VisibilityNotify, Grp::VISIBILITY, 'Visibility' ],
70
+ [ 16, :CreateNotify, Grp::CREATE, 'Create' ],
71
+ [ 17, :DestroyNotify, Grp::DESTROY, 'Destroy' ],
72
+ [ 18, :UnmapNotify, Grp::UNMAP, 'Unmap' ],
73
+ [ 19, :MapNotify, Grp::MAP, 'Map' ],
74
+ [ 20, :MapRequest, Grp::MAPREQ, 'MapRequest' ],
75
+ [ 21, :ReparentNotify, Grp::REPARENT, 'Reparent' ],
76
+ [ 22, :ConfigureNotify, Grp::CONFIG, 'Configure' ],
77
+ [ 23, :ConfigureRequest, Grp::CONFIGREQ, 'ConfigureRequest' ],
78
+ [ 24, :GravityNotify, Grp::GRAVITY, 'Gravity' ],
79
+ [ 25, :ResizeRequest, Grp::RESIZEREQ, 'ResizeRequest' ],
80
+ [ 26, :CirculateNotify, Grp::CIRC, 'Circulate' ],
81
+ [ 27, :CirculateRequest, 0, 'CirculateRequest' ],
82
+ [ 28, :PropertyNotify, Grp::PROP, 'Property' ],
83
+ [ 29, :SelectionClear, 0, ],
84
+ [ 30, :SelectionRequest, 0, ],
85
+ [ 31, :SelectionNotify, 0, ],
86
+ [ 32, :ColormapNotify, Grp::COLORMAP, 'Colormap' ],
87
+ [ 33, :ClientMessage, 0, ],
88
+ [ 34, :MappingNotify, 0, ],
89
+ [ 35, :VirtualEvent, Grp::VIRTUAL, ],
90
+ [ 36, :ActivateNotify, Grp::ACTIVATE, 'Activate' ],
91
+ [ 37, :DeactivateNotify, Grp::ACTIVATE, 'Deactivate' ],
92
+ [ 38, :MouseWheelEvent, Grp::MWHEEL, 'MouseWheel' ],
93
+ [ 39, :TK_LASTEVENT, 0, ]
94
+ ]
95
+
96
+ module TypeNum
97
+ end
98
+
99
+ TYPE_NAME_TBL = Hash.new
100
+ TYPE_ID_TBL = Hash.new
101
+ TYPE_GROUP_TBL = Hash.new
102
+
103
+ type_data.each{|id, c_name, g_flag, *t_names|
104
+ TypeNum.const_set(c_name, id)
105
+ t_names.each{|t_name| t_name.freeze; TYPE_NAME_TBL[t_name] = id }
106
+ TYPE_ID_TBL[id] = t_names
107
+ TYPE_GROUP_TBL[id] = g_flag
108
+ }
109
+
110
+ TYPE_NAME_TBL.freeze
111
+ TYPE_ID_TBL.freeze
112
+
113
+ def self.type_id(name)
114
+ TYPE_NAME_TBL[name.to_s]
115
+ end
116
+
117
+ def self.type_name(id)
118
+ TYPE_ID_TBL[id] && TYPE_ID_TBL[id][0]
119
+ end
120
+
121
+ def self.group_flag(id)
122
+ TYPE_GROUP_TBL[id] || 0
123
+ end
124
+
125
+ #############################################
126
+
127
+ module StateMask
128
+ ShiftMask = (1<<0)
129
+ LockMask = (1<<1)
130
+ ControlMask = (1<<2)
131
+ Mod1Mask = (1<<3)
132
+ Mod2Mask = (1<<4)
133
+ Mod3Mask = (1<<5)
134
+ Mod4Mask = (1<<6)
135
+ Mod5Mask = (1<<7)
136
+ Button1Mask = (1<<8)
137
+ Button2Mask = (1<<9)
138
+ Button3Mask = (1<<10)
139
+ Button4Mask = (1<<11)
140
+ Button5Mask = (1<<12)
141
+
142
+ AnyModifier = (1<<15)
143
+
144
+ META_MASK = (AnyModifier<<1)
145
+ ALT_MASK = (AnyModifier<<2)
146
+ EXTENDED_MASK = (AnyModifier<<3)
147
+
148
+ CommandMask = Mod1Mask
149
+ OptionMask = Mod2Mask
150
+ end
151
+
152
+ #############################################
153
+
154
+ FIELD_FLAG = {
155
+ # key => flag
156
+ 'above' => Grp::CONFIG,
157
+ 'borderwidth' => (Grp::CREATE|Grp::CONFIG),
158
+ 'button' => Grp::BUTTON,
159
+ 'count' => Grp::EXPOSE,
160
+ 'data' => (Grp::VIRTUAL|Grp::STRING_DATA),
161
+ 'delta' => Grp::MWHEEL,
162
+ 'detail' => (Grp::FOCUS|Grp::CROSSING),
163
+ 'focus' => Grp::CROSSING,
164
+ 'height' => (Grp::EXPOSE|Grp::CONFIG),
165
+ 'keycode' => Grp::KEY,
166
+ 'keysym' => Grp::KEY,
167
+ 'mode' => (Grp::CROSSING|Grp::FOCUS),
168
+ 'override' => (Grp::CREATE|Grp::MAP|Grp::REPARENT|Grp::CONFIG),
169
+ 'place' => Grp::CIRC,
170
+ 'root' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING),
171
+ 'rootx' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING),
172
+ 'rooty' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING),
173
+ 'sendevent' => Grp::ALL,
174
+ 'serial' => Grp::ALL,
175
+ 'state' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|
176
+ Grp::CROSSING|Grp::VISIBILITY),
177
+ 'subwindow' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING),
178
+ 'time' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING|
179
+ Grp::PROP),
180
+ 'warp' => Grp::KEY_BUTTON_MOTION_VIRTUAL,
181
+ 'width' => (Grp::EXPOSE|Grp::CREATE|Grp::CONFIG),
182
+ 'window' => (Grp::CREATE|Grp::UNMAP|Grp::MAP|Grp::REPARENT|
183
+ Grp::CONFIG|Grp::GRAVITY|Grp::CIRC),
184
+ 'when' => Grp::ALL,
185
+ 'x' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING|
186
+ Grp::EXPOSE|Grp::CREATE|Grp::CONFIG|Grp::GRAVITY|
187
+ Grp::REPARENT),
188
+ 'y' => (Grp::KEY_BUTTON_MOTION_VIRTUAL|Grp::CROSSING|
189
+ Grp::EXPOSE|Grp::CREATE|Grp::CONFIG|Grp::GRAVITY|
190
+ Grp::REPARENT),
191
+ }
192
+
193
+ FIELD_OPERATION = {
194
+ 'root' => proc{|val|
195
+ begin
196
+ Tk.tk_call_without_enc('winfo', 'pathname', val)
197
+ val
198
+ rescue
199
+ nil
200
+ end
201
+ },
202
+
203
+ 'subwindow' => proc{|val|
204
+ begin
205
+ Tk.tk_call_without_enc('winfo', 'pathname', val)
206
+ val
207
+ rescue
208
+ nil
209
+ end
210
+ },
211
+
212
+ 'window' => proc{|val| nil}
213
+ }
214
+
215
+ #-------------------------------------------
216
+
217
+ def valid_fields(group_flag=nil)
218
+ group_flag = self.class.group_flag(self.type) unless group_flag
219
+
220
+ fields = {}
221
+ FIELD_FLAG.each{|key, flag|
222
+ next if (flag & group_flag) == 0
223
+ begin
224
+ val = self.__send__(key)
225
+ rescue
226
+ next
227
+ end
228
+ # next if !val || val == '??'
229
+ next if !val || (val == '??' && (flag & Grp::STRING_DATA))
230
+ fields[key] = val
231
+ }
232
+
233
+ fields
234
+ end
235
+
236
+ def valid_for_generate(group_flag=nil)
237
+ fields = valid_fields(group_flag)
238
+
239
+ FIELD_OPERATION.each{|key, cmd|
240
+ next unless fields.has_key?(key)
241
+ val = FIELD_OPERATION[key].call(fields[key])
242
+ if val
243
+ fields[key] = val
244
+ else
245
+ fields.delete(key)
246
+ end
247
+ }
248
+
249
+ fields
250
+ end
251
+
252
+ def generate(win, modkeys={})
253
+ klass = self.class
254
+
255
+ if modkeys.has_key?(:type) || modkeys.has_key?('type')
256
+ modkeys = TkComm._symbolkey2str(modkeys)
257
+ type_id = modkeys.delete('type')
258
+ else
259
+ type_id = self.type
260
+ end
261
+
262
+ type_name = klass.type_name(type_id)
263
+ unless type_name
264
+ fail RuntimeError, "type_id #{type_id} is invalid"
265
+ end
266
+
267
+ group_flag = klass.group_flag(type_id)
268
+
269
+ opts = valid_for_generate(group_flag)
270
+
271
+ modkeys.each{|key, val|
272
+ if val
273
+ opts[key.to_s] = val
274
+ else
275
+ opts.delete(key.to_s)
276
+ end
277
+ }
278
+
279
+ if group_flag != Grp::KEY
280
+ Tk.event_generate(win, type_name, opts)
281
+ else
282
+ # If type is KEY event, focus should be set to target widget.
283
+ # If not set, original widget will get the same event.
284
+ # That will make infinite loop.
285
+ w = Tk.tk_call_without_enc('focus')
286
+ begin
287
+ Tk.tk_call_without_enc('focus', win)
288
+ Tk.event_generate(win, type_name, opts)
289
+ ensure
290
+ Tk.tk_call_without_enc('focus', w)
291
+ end
292
+ end
293
+ end
294
+
295
+ #############################################
296
+
297
+ # [ <'%' subst-key char>, <proc type char>, <instance var (accessor) name>]
298
+ KEY_TBL = [
299
+ [ ?#, ?n, :serial ],
300
+ [ ?a, ?s, :above ],
301
+ [ ?b, ?n, :num ],
302
+ [ ?c, ?n, :count ],
303
+ [ ?d, ?s, :detail ],
304
+ # ?e
305
+ [ ?f, ?b, :focus ],
306
+ # ?g
307
+ [ ?h, ?n, :height ],
308
+ [ ?i, ?s, :win_hex ],
309
+ # ?j
310
+ [ ?k, ?n, :keycode ],
311
+ # ?l
312
+ [ ?m, ?s, :mode ],
313
+ # ?n
314
+ [ ?o, ?b, :override ],
315
+ [ ?p, ?s, :place ],
316
+ # ?q
317
+ # ?r
318
+ [ ?s, ?x, :state ],
319
+ [ ?t, ?n, :time ],
320
+ # ?u
321
+ [ ?v, ?n, :value_mask ],
322
+ [ ?w, ?n, :width ],
323
+ [ ?x, ?n, :x ],
324
+ [ ?y, ?n, :y ],
325
+ # ?z
326
+ [ ?A, ?s, :char ],
327
+ [ ?B, ?n, :borderwidth ],
328
+ # ?C
329
+ [ ?D, ?n, :wheel_delta ],
330
+ [ ?E, ?b, :send_event ],
331
+ # ?F
332
+ # ?G
333
+ # ?H
334
+ # ?I
335
+ # ?J
336
+ [ ?K, ?s, :keysym ],
337
+ # ?L
338
+ # ?M
339
+ [ ?N, ?n, :keysym_num ],
340
+ # ?O
341
+ [ ?P, ?s, :property ],
342
+ # ?Q
343
+ [ ?R, ?s, :rootwin_id ],
344
+ [ ?S, ?s, :subwindow ],
345
+ [ ?T, ?n, :type ],
346
+ # ?U
347
+ # ?V
348
+ [ ?W, ?w, :widget ],
349
+ [ ?X, ?n, :x_root ],
350
+ [ ?Y, ?n, :y_root ],
351
+ # ?Z
352
+ nil
353
+ ]
354
+
355
+ # [ <'%' subst-key str>, <proc type char>, <instance var (accessor) name>]
356
+ # the subst-key string will be converted to a bytecode (128+idx).
357
+ LONGKEY_TBL = [
358
+ # for example, for %CTT and %CST subst-key on tkdnd-2.0
359
+ # ['CTT', ?l, :drop_target_type],
360
+ # ['CST', ?l, :drop_source_type],
361
+ ]
362
+
363
+ # [ <proc type char>, <proc/method to convert tcl-str to ruby-obj>]
364
+ PROC_TBL = [
365
+ [ ?n, TkComm.method(:num_or_str) ],
366
+ [ ?s, TkComm.method(:string) ],
367
+ [ ?b, TkComm.method(:bool) ],
368
+ [ ?w, TkComm.method(:window) ],
369
+
370
+ [ ?x, proc{|val|
371
+ begin
372
+ TkComm::number(val)
373
+ rescue ArgumentError
374
+ val
375
+ end
376
+ }
377
+ ],
378
+
379
+ nil
380
+ ]
381
+
382
+ =begin
383
+ # for Ruby m17n :: ?x --> String --> char-code ( getbyte(0) )
384
+ KEY_TBL.map!{|inf|
385
+ if inf.kind_of?(Array)
386
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
387
+ inf[1] = inf[1].getbyte(0) if inf[1].kind_of?(String)
388
+ end
389
+ inf
390
+ }
391
+
392
+ PROC_TBL.map!{|inf|
393
+ if inf.kind_of?(Array)
394
+ inf[0] = inf[0].getbyte(0) if inf[0].kind_of?(String)
395
+ end
396
+ inf
397
+ }
398
+ =end
399
+
400
+ # setup tables to be used by scan_args, _get_subst_key, _get_all_subst_keys
401
+ #
402
+ # _get_subst_key() and _get_all_subst_keys() generates key-string
403
+ # which describe how to convert callback arguments to ruby objects.
404
+ # When binding parameters are given, use _get_subst_key().
405
+ # But when no parameters are given, use _get_all_subst_keys() to
406
+ # create a Event class object as a callback parameter.
407
+ #
408
+ # scan_args() is used when doing callback. It convert arguments
409
+ # ( which are Tcl strings ) to ruby objects based on the key string
410
+ # that is generated by _get_subst_key() or _get_all_subst_keys().
411
+ #
412
+ _setup_subst_table(KEY_TBL, PROC_TBL)
413
+ # _setup_subst_table(KEY_TBL, LONGKEY_TBL, PROC_TBL) # if use longname-keys
414
+
415
+ #
416
+ # NOTE: The order of parameters which passed to callback procedure is
417
+ # <extra_arg>, <extra_arg>, ... , <subst_arg>, <subst_arg>, ...
418
+ #
419
+
420
+ # If you need support extra arguments given by Tcl/Tk,
421
+ # please override _get_extra_args_tbl
422
+ #
423
+ #def self._get_extra_args_tbl
424
+ # # return an array of convert procs
425
+ # []
426
+ #end
427
+
428
+ =begin
429
+ alias button num
430
+ alias delta wheel_delta
431
+ alias root rootwin_id
432
+ alias rootx x_root
433
+ alias root_x x_root
434
+ alias rooty y_root
435
+ alias root_y y_root
436
+ alias sendevent send_event
437
+ =end
438
+ ALIAS_TBL = {
439
+ :button => :num,
440
+ :data => :detail,
441
+ :delta => :wheel_delta,
442
+ :root => :rootwin_id,
443
+ :rootx => :x_root,
444
+ :root_x => :x_root,
445
+ :rooty => :y_root,
446
+ :root_y => :y_root,
447
+ :sendevent => :send_event,
448
+ :window => :widget
449
+ }
450
+
451
+ _define_attribute_aliases(ALIAS_TBL)
452
+
453
+ end
454
+
455
+ ###############################################
456
+
457
+ def install_bind_for_event_class(klass, cmd, *args)
458
+ extra_args_tbl = klass._get_extra_args_tbl
459
+
460
+ if args.compact.size > 0
461
+ args.map!{|arg| klass._sym2subst(arg)}
462
+ args = args.join(' ')
463
+ keys = klass._get_subst_key(args)
464
+
465
+ if cmd.kind_of?(String)
466
+ id = cmd
467
+ elsif cmd.kind_of?(TkCallbackEntry)
468
+ id = install_cmd(cmd)
469
+ else
470
+ id = install_cmd(proc{|*arg|
471
+ ex_args = []
472
+ extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
473
+ begin
474
+ TkUtil.eval_cmd(cmd, *(ex_args.concat(klass.scan_args(keys, arg))))
475
+ rescue Exception=>e
476
+ if TkCore::INTERP.kind_of?(TclTkIp)
477
+ fail e
478
+ else
479
+ # MultiTkIp
480
+ fail Exception, "#{e.class}: #{e.message.dup}"
481
+ end
482
+ end
483
+ })
484
+ end
485
+ elsif cmd.respond_to?(:arity) && cmd.arity == 0 # args.size == 0
486
+ args = ''
487
+ if cmd.kind_of?(String)
488
+ id = cmd
489
+ elsif cmd.kind_of?(TkCallbackEntry)
490
+ id = install_cmd(cmd)
491
+ else
492
+ id = install_cmd(proc{
493
+ begin
494
+ TkUtil.eval_cmd(cmd)
495
+ rescue Exception=>e
496
+ if TkCore::INTERP.kind_of?(TclTkIp)
497
+ fail e
498
+ else
499
+ # MultiTkIp
500
+ fail Exception, "#{e.class}: #{e.message.dup}"
501
+ end
502
+ end
503
+ })
504
+ end
505
+ else
506
+ keys, args = klass._get_all_subst_keys
507
+
508
+ if cmd.kind_of?(String)
509
+ id = cmd
510
+ elsif cmd.kind_of?(TkCallbackEntry)
511
+ id = install_cmd(cmd)
512
+ else
513
+ id = install_cmd(proc{|*arg|
514
+ ex_args = []
515
+ extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
516
+ begin
517
+ TkUtil.eval_cmd(cmd, *(ex_args << klass.new(*klass.scan_args(keys, arg))))
518
+ rescue Exception=>e
519
+ if TkCore::INTERP.kind_of?(TclTkIp)
520
+ fail e
521
+ else
522
+ # MultiTkIp
523
+ fail Exception, "#{e.class}: #{e.message.dup}"
524
+ end
525
+ end
526
+ })
527
+ end
528
+ end
529
+
530
+ if TkCore::INTERP.kind_of?(TclTkIp)
531
+ id + ' ' + args
532
+ else
533
+ # MultiTkIp
534
+ "if {[set st [catch {#{id} #{args}} ret]] != 0} {
535
+ if {$st == 4} {
536
+ return -code continue $ret
537
+ } elseif {$st == 3} {
538
+ return -code break $ret
539
+ } elseif {$st == 2} {
540
+ return -code return $ret
541
+ } elseif {[regexp {^Exception: (TkCallbackContinue: .*)$} \
542
+ $ret m msg]} {
543
+ return -code continue $msg
544
+ } elseif {[regexp {^Exception: (TkCallbackBreak: .*)$} $ret m msg]} {
545
+ return -code break $msg
546
+ } elseif {[regexp {^Exception: (TkCallbackReturn: .*)$} $ret m msg]} {
547
+ return -code return $msg
548
+ } elseif {[regexp {^Exception: (\\S+: .*)$} $ret m msg]} {
549
+ return -code return $msg
550
+ } else {
551
+ return -code error $ret
552
+ }
553
+ } else {
554
+ set ret
555
+ }"
556
+ end
557
+ end
558
+
559
+ def install_bind(cmd, *args)
560
+ install_bind_for_event_class(TkEvent::Event, cmd, *args)
561
+ end
562
+ end