From: Neil Conway Date: 2001-09-22T08:25:26+09:00 Subject: [ruby-talk:21506] Re: ruby-gtk and entry validation Hi, On Thu, 2001-09-20 at 19:24, Ned Konz wrote: > The Gtk FAQ has an example of validating a Gtk::Entry field using an > insert_text handler: > > [snip C code] > > The problem is that I can't find any way in ruby-gtk to do this. There is > signal_handler_unblock in Gtk::Object but not > signal_handler_unblock_by_func(). Okay, the reason you can't find those functions is because they're not implemented ;-) It's a bit difficult to implement them properly because of the way that signal handlers are implemented in Ruby/GTK: as (anonymous) blocks. This is convenient, but it means that the programmer can't refer back to the signal handler by name. I'm still thinking about how to do this. For now, here's a simple work-around: signal_connect returns the connection ID of the newly created signal handler. Then you can use the Gtk::Object methods signal_handler_block() and signal_handler_unblock(), which take the connection ID. I haven't tested it but AFAICT it should work. In the upcoming Ruby-GNOME 0.26, the missing functions will at least call rb_notimplement() and bail out; if anyone can think of a way to implement these functions nicely, let me know. Cheers, Neil Conway Ruby-GNOME maintainer