Re: wy signal handler could not be override
- From: Jonas Platte <jonasplatte myopera com>
- To: Klaus Rudolph <lts-rudolph gmx de>
- Cc: gtkmm-list gnome org
- Subject: Re: wy signal handler could not be override
- Date: Fri, 29 Mar 2013 13:31:40 +0100
Am 29.03.2013 12:52, schrieb Klaus Rudolph:
I want to override a signal handler in a derived class:
class MyRect : public Goocanvas::Rect
{
public:
MyRect( double x, double y, double w, double h):
Goocanvas::Rect( x,y,w,h)
{
}
public:
bool on_button_press_event(const Glib::RefPtr<Item>& target, GdkEventButton* event)
{
cout << "catch it" << endl;
return true;
}
};
But the handler is never invoked!
Any advice how to override a signal handler?
Manual adding the handler by
(Glib::RefPtr<Goocanvas::Item>&)m_rect_own)->signal_button_press_event().connect(sigc::ptr_fun(&MyHandler4));
works. But this is not very handy :-(
Regards
Klaus
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list
I've googled the thing and can't find any mistake in your function.
But to make sure you're really overriding the function, you can use the
override keyword from C++11, if your compiler supports that. For g++,
you can activate C++11 features with the -std=c++11 compiler flag (I'm
not sure if that is necessary)
You would then declare the function as follows:
virtual bool on_button_press_event(const Glib::RefPtr<Item>& target, GdkEventButton* event) override
{
cout << "catch it" << endl;
return true;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]