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



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.

Glade derives two classes from Gtk::Window:
                                  |
                             window1_glade   // can't edit this
                                  |
                               window1

In window1_glade I have a drawingarea and a pure virtual handler:

class window1_glade : public Gtk::Window
{
public:
        class Gtk::DrawingArea *drawingarea1;
protected:
        window1_glade();
        ~window1_glade();
private:
        virtual void on_drawingarea1_realize() = 0;
};

and in window1 I have

class window1 : public window1_glade
{
        void on_drawingarea1_realize();
};

In the window1_glade() constructor I have

window1_glade::window1_glade() : Gtk::Window(Gtk::WINDOW_TOPLEVEL)
{
   Gtk::Window *window1 = this;
   drawingarea1 = Gtk::manage(new class Gtk::DrawingArea());
   // more stuff
   window1->add(*drawingarea1);
   drawingarea1->show();
   window1->show();
   drawingarea1->signal_realize().connect(SigC::slot(*this,
&window1_glade::on_drawingarea1_realize), true);
}

> 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.

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?

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




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