Tk: event.widget.callback_break

Did Tk change between 1.6.5 and 1.6.7? After several months occupied with
other chores, and then installing 1.6.7 I find that some old code (vintage
1.6.5) using TkText::callback_break no longer works.

Hi,

Sorry too late. But I’m a little busy. :slight_smile:

···

From: Albert Wagner alwagner@tcac.net
Subject: Tk: event.widget.callback_break
Date: Thu, 18 Jul 2002 01:40:55 +0900
Message-ID: 200207171132.41734.alwagner@tcac.net

Did Tk change between 1.6.5 and 1.6.7? After several months occupied with
other chores, and then installing 1.6.7 I find that some old code (vintage
1.6.5) using TkText::callback_break no longer works.

From: Albert Wagner alwagner@tcac.net
Subject: callback_break, callback_continue
Date: Thu, 18 Jul 2002 09:09:01 -0500
Message-ID: 200207180909.01670.alwagner@tcac.net

I’m trying to run some old code in Ruby-1.6.7 on Linux. But something
appears to have changed in Ruby/Tk since I wrote it. Code like:

event.widget.callback_break

now returns an error:

Exception `TkCallbackBreak’ at /usr/lib/ruby/1.6/tk.rb:487 - Tk callback
returns ‘break’ status

Unfortunately, I cannot re-generate this problem.
The following script is running correctly on my environment.

require 'tk’
t = TkText.new.pack
t.bind(‘Key-t’, proc{|ev|p ev; p ‘key t’; ev.widget.callback_break})
t.bind(‘Key-u’, proc{|ev|p ev; p ‘key u’; ev.widget.callback_continue})
t.bind(‘Key-v’, proc{p ‘key v’; t.callback_break; p ‘end of callback’})
t.bind(‘Key-w’, proc{p ‘key w’; t.callback_continue; p ‘end of callback’})
t.bind(‘Key-x’, proc{p ‘key x’; Tk.callback_break; p ‘end of callback’})
t.bind(‘Key-y’, proc{p ‘key y’; p ‘end of callback’})
t.bind(‘Key-z’, proc{p ‘key z’; Tk.callback_continue; p ‘end of callback’})
Tk.mainloop

Are you running your script on some debugging environment?
Each of Tk.callback_break and Tk.callback_continue generates
an exception to pass the status-code from Ruby to Tcl.
So, if running on a ruby debugger, the debugger will catch the exception
and stop running the script.

                              Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

I have tried running with and without the -d option. Yes, with the -d option
the script stops. However, without the -d option, with both my own code and
your code above the script stops hard requiring me to manually kill the
process. I have tcl/tk-8.3.4 installed. Does that make a difference? I am
on Linux-2.4.18/KDE-3.0.1/Ruby-1.6.7

···

On Thursday 18 July 2002 09:12 pm, nagai@ai.kyutech.ac.jp wrote:

Hi,

Sorry too late. But I’m a little busy. :slight_smile:

From: Albert Wagner alwagner@tcac.net
Subject: Tk: event.widget.callback_break
Date: Thu, 18 Jul 2002 01:40:55 +0900
Message-ID: 200207171132.41734.alwagner@tcac.net

Did Tk change between 1.6.5 and 1.6.7? After several months occupied
with other chores, and then installing 1.6.7 I find that some old code
(vintage 1.6.5) using TkText::callback_break no longer works.

From: Albert Wagner alwagner@tcac.net
Subject: callback_break, callback_continue
Date: Thu, 18 Jul 2002 09:09:01 -0500
Message-ID: 200207180909.01670.alwagner@tcac.net

I’m trying to run some old code in Ruby-1.6.7 on Linux. But something
appears to have changed in Ruby/Tk since I wrote it. Code like:

event.widget.callback_break

now returns an error:

Exception `TkCallbackBreak’ at /usr/lib/ruby/1.6/tk.rb:487 - Tk callback
returns ‘break’ status

Unfortunately, I cannot re-generate this problem.
The following script is running correctly on my environment.

require 'tk’
t = TkText.new.pack
t.bind(‘Key-t’, proc{|ev|p ev; p ‘key t’; ev.widget.callback_break})
t.bind(‘Key-u’, proc{|ev|p ev; p ‘key u’; ev.widget.callback_continue})
t.bind(‘Key-v’, proc{p ‘key v’; t.callback_break; p ‘end of callback’})
t.bind(‘Key-w’, proc{p ‘key w’; t.callback_continue; p ‘end of callback’})
t.bind(‘Key-x’, proc{p ‘key x’; Tk.callback_break; p ‘end of callback’})
t.bind(‘Key-y’, proc{p ‘key y’; p ‘end of callback’})
t.bind(‘Key-z’, proc{p ‘key z’; Tk.callback_continue; p ‘end of callback’})
Tk.mainloop

Are you running your script on some debugging environment?
Each of Tk.callback_break and Tk.callback_continue generates
an exception to pass the status-code from Ruby to Tcl.
So, if running on a ruby debugger, the debugger will catch the exception
and stop running the script.