Re: [Fwd: connecting to signal_focus_out_event with additional parameters]



I suggest that you derive a new Gtk::Entry, and make the signal handler a
member method of it, or use sigc::bind() to pass a pointer to the
Gtk::Entry.

> I forgot to mention this:
>
> I have three different *arrays* of Gtk::Entry object pointers, each of
> which contains six members that must be connected to the
> signal_focus_out_event signal and be vetted as explained below, hence I
> cannot know which Gtk::Entry generated the event without further data.
>
> Bob
>
> -------- Original Message --------
> Subject: 	connecting to signal_focus_out_event with additional parameters
> Date: 	Thu, 20 Oct 2005 08:41:21 -0500
> From: 	Bob Caryl <bob fis-cal com>
> To: 	gtkmm-list <gtkmm-list gnome org>
>
>
>
> Hi guys,
>
> I'm trying to connect to Gtk::Entry::signal_focus_out_event() so that I
> can vet the contents of the Gtk::Entry when it loses focus.  I tried
> doing it the normal way:
>
> myentry->signal_focus_out_event().connect(sigc::mem_fun(*this,&MyClass::on_entry_focus_out))
>
> where on_entry_focus_out is prototyped thus:
>
> bool MyClass::on_entry_focus_out(GdkEventFocus *focus);
>
> My problem is that the GdkEventFocus::window member is merely a pointer
> to a GdkWindow drawable (and I also tried casting the result of
> gdk_parent_window(focus->window) to a Gtk::Entry * and it still caused a
> seg fault when run), and doesn't give me access to my Gtk::Entry from
> which the connection was originally made, so I tried doing this:
>
> myentry->signal_focus_out_event().connect(sigc::bind<Gtk::Entry
> *>(sigc::mem_fun(*this,&MyClass::on_entry_focus_out),myentry));
>
> where on_entry_focus out is prototyped thus:
>
> bool MyClass::on_entry_focus_out(GdkEventFocus *focus,Gtk::Entry *entry);
>
> This construct compiles, but the linker has big problems with it.
>
> Can someone point to me a URL that will illustrate the error of my
> ways?  I really didn't want to do this at all, but my boss insists on
> this idiot-proofing vetting process for the data entered here.
>
> Thanks,
>
> Bob Caryl
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>


Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]