problem with signal_button_press_event of DrawingArea



I program with gtkmm-2.14 whose installer is download from gtkmm.org under windows. My compiler is Mingw.
My problem is that the button_press_event of a drawingarea object set up on a dialog doesn't send signal when I click on it. The dialog object is constructed when a button on the MainWindow is clicked.
All the event of the drawingarea object is connected with the following code written in the construct function of the dialog:

m_DrawingAreaSnapshot->signal_expose_event().connect(mem_fun(*this,&CalibrationWizard::on_drawingarea_expose_event));    m_DrawingAreaSnapshot->signal_configure_event().connect(mem_fun(*this,&CalibrationWizard::on_drawingarea_configure_event));   m_DrawingAreaSnapshot->signal_button_press_event().connect(mem_fun(*this,&CalibrationWizard::on_button_press_event));
m_DrawingAreaSnapshot->signal_button_release_event().connect(mem_fun(*this,&CalibrationWizard::on_button_release_event));
m_DrawingAreaSnapshot->signal_motion_notify_event().connect(mem_fun(*this,&CalibrationWizard::on_motion_notify_event));
m_DrawingAreaSnapshot->add_events(Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);

The callbacks of expose_event and configure_event take effect, but the latter three events' callbacks have never been called. I confirm this by coding some printing operations in the callback function. But I get no printing on the console when click on the drawingarea.
There is also a drawingarea in the MainWindow object, whose event is connected the same way as the code shown above. The signal_button_xxx_event and signal_motion_notify_event work well.
I can't figure out why drawingarea work well on the Mainwindow but don't work correctly on a temperory dialog. I appreciate an answer, thanks.



免费送你和爱人去新加坡过情人节!


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