Re: [gtkmm] on_realize()!=signal_realize() ? , was: glade-2 + on_realize()



Silviu D Minut schrieb:
I assume I'm doing something wrong (e.g. use the wrong return value), but
that's because of the code generated by glade. Please take a look at the
code below, I really need help with this.

return value? signal_realize needs a void (void) callback. That's no return value at all ...

It's wrapped like every other signal. Because this is an X event signal
http://www.gtkmm.org/gtkmm2/docs/tutorial/html/apbs06.html
he's probably just using the wrong return value, or needs to use
connect_notify() instead.

Quoting widget.h:

Glib::SignalProxy0<void> signal_realize();

Is this an X event signal - if so, why does it have neither argument nor return value?


If I understand this, the problem is with

void on_drawingarea1_realize();    // note the void return type

and/or

   drawingarea1->signal_realize().connect(SigC::slot(*this,
&window1_glade::on_drawingarea1_realize), true);

These were created by glade. I'm not supposed to edit the files where
these two instructions occur, because glade overrides them. Is glade
generating the wrong code? Is there any way to make it do the right
thing?

I don't think glade is generating wrong code

Also, I noticed that if I make on_drawingarea1_realize() a nonvirtual
function in window1_glade and implement it, it works.

Oooops. Well this clears it out:

virtual functions are only legally called after the class is fully initialized. So if for any reason ;-) on_realize is called within window1::window1 it is not allowed to call window1::on_drawingarea1_realize before the ctor has finished
[window1_glade::on_drawingarea1_realize is legal].

Perhaps putting drawingarea1 in a "separate class" will help here (because then drawingarea1::drawingarea1 has finished before the widget will be realized).

All in all this is just a bit beyond the border of glade(mm)'s capabilities/design. I never realized ;-) this.

   Christof




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