wy signal handler could not be override

2013-03-29 Thread 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::RefPtrItem target,

Re: wy signal handler could not be override

2013-03-29 Thread Jonas Platte
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

Aw: Re: wy signal handler could not be override

2013-03-29 Thread Klaus Rudolph
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

Re: wy signal handler could not be override

2013-03-29 Thread Jonas Platte
Am 29.03.2013 13:56, schrieb Klaus Rudolph: 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

Re: Aw: Re: wy signal handler could not be override

2013-03-29 Thread Yann Leydier
In C++, declaring the method as virtual is needed if you want to override anything by polymorphism. However, in Gtkmm, I never override methods. Signals do the same job and are more flexible, so I connect methods to the signals I want to handle in the constructor:

Aw: Re: wy signal handler could not be override

2013-03-29 Thread Klaus Rudolph
I'll try to reproduce it. But first, which version of goocanvasmm are you using? In the Ubuntu repositories, there are two versions, 1.0 and 2.0. And, how should the signal normally be emitted? Is your function called when you emit the signal manually? goocanvasmm: 0.15.4-7fc17 ( I am on a fedora

Re: wy signal handler could not be override

2013-03-29 Thread Jonas Platte
Am 29.03.2013 14:31, schrieb Klaus Rudolph: To override the signal handler is part of the documentation. Looking in the sources shows the virtual functions: virtual bool on_Signal_Name(...); But it seems simply not to work as expected and I have no idea why. I would provide a full

Aw: Re: wy signal handler could not be override

2013-03-29 Thread Klaus Rudolph
  It would be better to declare the override-method as virtual, but I don't think it is necessary. But try that too. Overriding a virtual function needs no additional virtual. What I think is the most probable answer to the question why your method is not called, is that the default signal

Re: wy signal handler could not be override

2013-03-29 Thread Jonas Platte
Am 29.03.2013 15:05, schrieb Klaus Rudolph: It would be better to declare the override-method as virtual, but I don't think it is necessary. But try that too. Overriding a virtual function needs no additional virtual. What I think is the most probable answer to the question why your

Re: Aw: Re: wy signal handler could not be override

2013-03-29 Thread Krzysztof Kosiński
2013/3/29 Yann Leydier y...@leydier.info In C++, declaring the method as virtual is needed if you want to override anything by polymorphism. In this case it isn't. The 'virtual' keyword is only required in the base class. In derived classes, if the function name matches a virtual function in a

Re: Aw: Re: wy signal handler could not be override

2013-03-29 Thread Kjell Ahlstedt
2013-03-29 15:05, Klaus Rudolph skrev: What I think is the most probable answer to the question why your method is not called, is that the default signal handler is empty and therefore it was not considered necessary to connect it to the signal The handler in the Item class calls with obj-func