diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-08-01 09:25:37 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-08-01 09:25:37 +0000 |
| commit | 56160fa00424ee3aecd14b72457ad19d34dc2c26 (patch) | |
| tree | ebd326e315572f9712a37a81ab46c35dea88f1b5 /ext/tk | |
| parent | 7e74039572825048f021214f746badb938d65694 (diff) | |
| download | ruby-56160fa00424ee3aecd14b72457ad19d34dc2c26.tar.gz ruby-56160fa00424ee3aecd14b72457ad19d34dc2c26.tar.xz ruby-56160fa00424ee3aecd14b72457ad19d34dc2c26.zip | |
matz
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk')
| -rw-r--r-- | ext/tk/lib/tkafter.rb | 26 | ||||
| -rw-r--r-- | ext/tk/lib/tktext.rb | 8 |
2 files changed, 27 insertions, 7 deletions
diff --git a/ext/tk/lib/tkafter.rb b/ext/tk/lib/tkafter.rb index 55bfde4d5..fe3ee3874 100644 --- a/ext/tk/lib/tkafter.rb +++ b/ext/tk/lib/tkafter.rb @@ -1,6 +1,6 @@ # # tkafter.rb : methods for Tcl/Tk after command -# 1998/07/02 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp> +# 2000/08/01 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp> # require 'tk' @@ -37,7 +37,16 @@ class TkAfter ############################### def do_callback(*args) @in_callback = true - ret = @current_proc.call(*args) + begin + ret = @current_proc.call(*args) + rescue StandardError, NameError + if @cancel_on_exception + cancel + return nil + else + fail $! + end + end if @set_next set_next_callback(*args) else @@ -118,6 +127,8 @@ class TkAfter @after_id = nil @after_script = nil + @cancel_on_exception = true + set_procs(*args) if args != [] @running = false @@ -135,7 +146,16 @@ class TkAfter end def current_status - [@running, @current_sleep, @current_proc, @current_args, @do_loop] + [@running, @current_sleep, @current_proc, @current_args, + @do_loop, @cancel_on_exception] + end + + def cancel_on_exception? + @cancel_on_exception + end + + def cancel_on_exception=(mode) + @cancel_on_exception = mode end def running? diff --git a/ext/tk/lib/tktext.rb b/ext/tk/lib/tktext.rb index 163583f13..f7b3f84ba 100644 --- a/ext/tk/lib/tktext.rb +++ b/ext/tk/lib/tktext.rb @@ -460,7 +460,7 @@ class TkText<TkTextWin when 'anchor' result.push TkTextMarkAnchor.new(self) else - result.push tk_tcl2rb(val) + result.push tk_tcl2ruby(val) end when 'tagon' if val == 'sel' @@ -470,12 +470,12 @@ class TkText<TkTextWin result.push TkTextTagSel.new(self) end else - result.push tk_tcl2rb val + result.push tk_tcl2ruby(val) end when 'tagoff' - result.push tk_tcl2rb sel + result.push tk_tcl2ruby(sel) when 'window' - result.push tk_tcl2rb val + result.push tk_tcl2ruby(val) end i = idx + 1 end |
