elbows
10/25/2003 4:26:00 AM
This is a known bug, and I believe is fixed in a later (CVS?) version
of ruby-tk which is not yet available in debian. If you search this
newsgroup in google groups, there have been a couple of threads on the
problem. IIRC, there is some magic code you can put at the beginning
of your program that prevents this bug.
Alternatively, you can just download to the stable versions of ruby
(1.6.7) and libtk-ruby, which is what I have done for the moment.
I have also reported this as a bug against the debian package, so
hopefully it will be fixed someday.
Nathan
Ferenc Engard <ferenc@engard.hu> wrote in message news:<3F97D937.CCC79066@engard.hu>...
> Hello,
>
> Take the following example:
>
> --------------------------------------
> require 'tk.rb'
> trap 0, proc { sleep 0.1 }
>
> e=TkEntry.new()
> e.validatecommand([proc{|w,t| valid(w,t)},'%W %V'])
> e.validate('focusout')
> e2=TkEntry.new()
>
> e.pack
> e2.pack
>
> def valid(w,t)
> puts "valid!"
> raise "exception"
> end
>
> Tk.mainloop
> --------------------------------------
>
> (The trap cmd still needed with the latest debian unstable ruby -- ruby
> 1.8.0 (2003-10-05) [i386-linux]...) :-(
>
> If I focus e, then take focus away, it prints "valid!" and raises an
> exception, as I expect. BUT, after that, the valid() method never runs
> on subsequent focus loses!
>
> What is the problem?
>
> Ferenc