Re: [gtkmm] Converting from GTK+ to Gtkmm
- From: Roger Leigh <roger whinlatter uklinux net>
- To: gtkmm-list gnome org
- Subject: Re: [gtkmm] Converting from GTK+ to Gtkmm
- Date: Sat, 12 Jul 2003 23:36:46 +0100
Ole Laursen <olau hardworking dk> writes:
> Roger Leigh <roger whinlatter uklinux net> writes:
[signal autoconnection]
> But actually I don't see how - if you restructure your application to
> have a proper OO structure as hinted in "Programming with gtkmm", you
> most often need to connect signals to specific objects. It would need
> quite some amount of ingenuity to make auto-connection work with that.
> Truth is it's only a minor hassle once you get used to it.
Thanks for the explanation.
[snipped useful comments]
>> xml_interface = Gnome::Glade::Xml::create("ogcalc-gl.glade");
>> xml_interface->reparent_widget("vbox1", *this);
>
>> // Set up signal handlers for numeric entries.
>> [...]
>> if (cf_entry)
>> cf_entry->signal_activate().connect( SigC::hide_return( SigC::slot(*this,
>> &Gtk::Window::activate_default) ) );
>> }
>>
>> This all works, but with one exception. The last signal hander
>> (Gtk::Window::activate_default()) returns a bool, so I can't connect
>> it with SigC::slot. The sigc++ documentation says to use
>> SigC::hide_return, but using the above call results in a segfault when
>> it is triggered (gdb shows it use up all the stack as it recurses
>> forever).
>
> I don't have much clue, but are you sure active_default doesn't active
> the entry? Have you tried inserting a middle method that simply calls
> activate_default?
This gave me an idea, and I found the problem:
I just added this to the end of the constructor:
// Ensure calculate is the default.
calculate_button->grab_default();
So (I think) Gnome::Glade::Xml::reparent_widget() is not setting the
default widget correctly. Whatever the default widget was before
reparenting is not changed (it was an empty window before, so I'm
surprised there was any default at all). Is this a bug in libglademm?
The calculate button is the only widget that can default.
Regards,
Roger
--
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848 available on public keyservers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]