Re: widget not getting button event?



A widget without a window doesn't receive events, you need to place the label inside an eventbox.

see
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1EventBox.html

On Mon, 7 Feb 2005 17:06:16 +0100 (CET), Maroy Akos <darkeye tyrell hu> wrote:

Hi,

I'm trying to catch the button click event, when the user clicks on a Gtk::Label. I have a label named title, and I use the following code in the window containing it:

     add_events(Gdk::ALL_EVENTS_MASK);
     title->add_events(Gdk::ALL_EVENTS_MASK);
     title->signal_button_press_event().connect(sigc::mem_fun(*this,
                                              &MyWindow::onTitleClicked));

but, for some reason, my event handler never gets called. if I use:

     signal_button_press_event().connect(sigc::mem_fun(*this,
                                              &MyWindow::onTitleClicked));


it does get called, but then of course it gets called on any click in the window, not on the title label.

what am I doing wrong?



Akos

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list






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