Re: [glade--] glademm auto-connect feature?



> Murray Cumming <murrayc murrayc com> wrote:
> > I don't use the code generation of glade.
> 
> We thought that you did because you used the glademm mailing list.
> glademm does code generation.
> 
> I've changed this email thread to the gtkmm-list, which is relevant for
> libglademm.

sorry, i thought that the glademm-list is for everything which have to do
with the usage of glade. Thanks for moving the thread to gtkmm-list.
 
> > But libglade doesn't offers a auto connect feature for C++
> 
> I have generally not bothered with this, because there's no way for you
> to specify in Glade what object the signal handler should be a member
> method of. However, see below.

i think this wouldn't be a problem. I would say 99% of every signals get
connected to the same class which handles the XML file. At least i'm
generally generate for every window a class and this class handles all
signals form the window.
If there are some signals which get connected to a special class than you
could still do it by hand. But for all the standard-connections a
autoconnect() method could save a lot of typing.

> >  C#
> 
> I looked at an example that did this recently. I think the equivalent in
> C++ would look something like this:
> 
> Something::example_thing()
> {
> ...
>   Gtk::Dialog* pDialog = 0;
>   refXml->get_widget("DialogBasic", pDialog);
> 
>   refXml->autoconnect(*this); //Doesn't exist yet.
> ...
> }

yes, this would something similar for gtkmm
 
> So, if you had specified on_ok_clicked() as the signal handler for the 
> clicked signal of an OK button, then it would look for a 
> Something::on_ok_clicked() method and connect it with the this instance. 
> That would be equivalent to doing
>   button_ok->signal_clicked().connect(sigc::mem_fun(*this,
> &Something::on_something_clicked));
> 
> However, the autoconnect() method would need to know, or discover, what
> C++ parameters the signal handler takes and know how to convert from the
> C types to the C++ types. And back again, if there is a return type or
> output parameters (rare).

i don't know how to implement something like a autoconnect(), therefor i'm
to young in GUI-programming.
But for this example the autoconnect() method would just have to
create/execute this command: 
button_ok->signal_clicked().connect(sigc::mem_fun(*this,
&Something::on_something_clicked));

This shouldn't be to hard?

> I don't know how they deal with this in Gtk#, but I am generally not
> impressed with the Gtk# API and I suspect that the autoconnect system is
> not as reliable or useful as it is presented to be.

I would be interested in your criticism about the Gtk# API, do you have some
example what you don't like? I haven't done much with it but for me it looks
really nice and afaik almost every Gtk# app uses the autoconnect(), so it
should be reliable and useful and it saves you a lot of typing.

-- 
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner



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