I find that drawingarea in a dialog with button can emit response signal can't
process its button_press, button_release and motion_notify signal. The
following code can reproduce the problem.
//test.h///////////////////////////////////////////////////////////////
#ifndef TEST_H
#define TEST_H
#include <gtkmm.h>
using namespace Gtk;
using namespace Gdk;
using namespace Glib;
using namespace sigc;
class test : public Dialog {
protected:
Button m_cancelbutton,m_okbutton;
DrawingArea m_DrawingArea;
virtual bool on_drawingarea_button_press_event(GdkEventButton * event);
virtual bool on_drawingarea_button_release_event(GdkEventButton * event);
public:
test();
virtual ~test();
};
#endif
//test.cpp/////////////////////////////////////////////////////////////
#include <iostream>
#include "test.h"
using namespace std;
test::test()
:Dialog("test",false,true),
m_okbutton(StockID("gtk-ok")),
m_cancelbutton(StockID("gtk-cancel"))
{
add_action_widget(m_cancelbutton,-6);
add_action_widget(m_okbutton,-5);
m_DrawingArea.set_size_request(320,240);
get_vbox()->pack_start(m_DrawingArea);
m_DrawingArea.signal_button_press_event().connect(mem_fun(*this,&test::on_button_press_event),false);
m_DrawingArea.signal_button_release_event().connect(mem_fun(*this,&test::on_button_release_event),false);
show_all();
}
test::~test()
{
}
bool test::on_drawingarea_button_press_event(GdkEventButton * event)
{
cout<<"press"<<endl;
}
bool test::on_drawingarea_button_release_event(GdkEventButton * event)
{
cout<<"release"<<endl;
}
//main.cpp////////////////////////////////////////////////////////////
#include <gtkmm.h>
#include "test.h"
int main(int argc,char* argv[])
{
Main kit(argc,argv);
test t;
kit.run(t);
}
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list