widget not getting button event?



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




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