Re: [gtkmm] compilation error due to a signal connect



Roger Leigh a écrit :

cedric <cedric probesys com> writes:

hi!
i m a newbie on gtkmm and i have a little (BIG ;-/ ) problem:

i ve made a class "test". in the constructor, i create a
Gtk::Menu::MenuElem MenuName, and i want to connect it with a function
"print". it works only and only if this "print" function is declared
as static, because if i declare it virtual (or even without virtual)
and not static, i have a compilation error :

                        SigC::slot(&test::print) ); //here is the problem!

A pointer to a class member function requires a reference to the class
as well as the method:

   SigC::slot(*this, &test::print) );


yes, you re right!
i ve just forgotten to put it in my mail, but it was in my source!

because if i declare "print" as "static void print();" and if i put also

"...SigC::slot(&test::print) );", it works ! and i forgot to reput "*this"!
sorry for my mistake! but the problem still remains :'(
hoping not to abuse of your kindness





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