Re: why on_configure_event() is never called here ?



On Thu, 06 Aug 2009 17:16:52 -0400
José Alburquerque <jaalburquerque cox net> wrote:

> On Thu, 2009-08-06 at 04:47 -0800, Renato Merli wrote: 
> > class myCtn : public Gtk::Fixed
> > {
> > 
> >     public:
> >         Gtk::Button btn;
> >         int x, y;
> > 
> >      bool on_configure_event (GdkEventConfigure *e)
> >     {
> >         printf("\non configure");
> >         return false;
> > 
> >     };
> > 
> > 
> >         void botao_clicked()
> >     {
> >         x += 25;
> >         y = x;
> >         Gtk::Button *tmp = new Gtk::Button("Button");
> >         put(*tmp, x, y);
> >         tmp->show();
> >     };
> > 
> > 
> > 
> >         myCtn(): btn("Botao"){
> >             add_events (Gdk::ALL_EVENTS_MASK);
> >             put (btn,0,0);
> >             btn.signal_clicked().connect(sigc::mem_fun(this,
> > &myCtn::botao_clicked));
> >             x=y=0;
> >             btn.show();
> > 
> >         };
> > 
> > 
> > 
> > 
> > };
> > 
> > 
> > 
> > int main (int argc, char *argv[])
> > {
> > 
> >     Gtk::Main kit(argc, argv);
> >     Gtk::Window win;
> > 
> >     myCtn box;
> >     win.add(box);
> >     win.show_all();
> >     Gtk::Main::run(win);
> > 
> > }
> > 
> > 
> > What am i missing ?
> 
> Did you connect to the signal_configure_event()?

He was overriding the on_configure_event() virtual protected function -
he did not need to connect to any signal.

> On the other hand, I
> think that Gtk::Fixed does not have a Gdk::Window of its own by
> default so it may be necessary to use Gtk::Fixed::set_has_window() so
> it will receive the configure events (I'm not sure).

I suspect that is the reason.  Possibly Gtk::Fixed objects would not
receive configure events anyway, because they do not allocate their
size.

Chris



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