Re: libglademm: on_realize signal doesn't seem to connect



Am Montag, den 08.05.2006, 15:34 +0200 schrieb Joost Ellerbroek:
> Hi,
> 
> I've just stopped using glade-- in favour of libglademm.
> I'm having a problem with DrawingArea though. Right now I'm just
> trying to connect the on_realize() signal, but it never gets called. I
> use the get_widget_derived. 

My guess is that by the time the sigc++ signal handler is connected, the
widget has already been realized.  Try calling is_realized() to confirm
this.

> From the code below, can someone tell me what I'm doing wrong? thanks

> void DerivedDrawingArea::on_drawingarea_realize()
> {
>     Gtk::DrawingArea::on_realize();
      ^^^^^

Not related to your problem; but you should definitely not do this.
on_drawingarea_realize() is connected to a sigc++ signal in your code,
which is an independent mechanism from the default handler virtual
methods provided by gtkmm.  If you'd actually receive the "realize"
signal, the method Gtk::DrawingArea::on_realize() would get called
twice.  Ouch.

In short, only forward to the base class' method if you're actually
overriding it.

--Daniel





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