[gtkmm] compilation error due to a signal connect
- From: cedric <cedric probesys com>
- To: gtkmm-list gnome org
- Subject: [gtkmm] compilation error due to a signal connect
- Date: Tue, 13 Apr 2004 16:16:54 +0200
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 :
" /usr/include/sigc++-1.2/sigc++/object_slot.h: in constructor
SigC::ObjectSlotNode::ObjectSlotNode(void(*)(void*), T*, void*, T2)
[with T=test, T2=void (test::*)()]:
...
it tells me that there no matching function in object_slot.h for the
call to
enuName = new Gtk::Menu_Helpers::MenuElem("test",
Gtk::Menu::AccelKey("<control>t"),
SigC::slot(&test::print) ); //here is the problem!
"
i don t uderstand! :p
here are my source code:
//--------------------------begin
test.hh----------------------------------------
#ifndef EASYGEST_TEST
#define EASYGEST_TEST
#include <gtkmm.h>
class test
{
public:
test();
virtual ~test();
virtual Gtk::Menu_Helpers::MenuElem getMenuName();
virtual Gtk::TreeModel::Row getTreeNode();
static void print(); // virtual void print();
Gtk::Menu_Helpers::MenuElem *MenuName;
Gtk::TreeModel::Row TreeNode;
};
#endif //EASYGEST_TEST
//--------------------------begin
test.hh----------------------------------------
//--------------------------begin
test.cc----------------------------------------
#include <iostream>
#include "test.hh"
test::test()
{
MenuName = new Gtk::Menu_Helpers::MenuElem("test",
Gtk::Menu::AccelKey("<control>t"),
SigC::slot(&test::print) ); //here is the problem!
}
test::~test()
{
delete MenuName;
}
Gtk::Menu_Helpers::MenuElem test::getMenuName()
{
return *MenuName;
}
Gtk::TreeModel::Row test::getTreeNode()
{
return TreeNode;
}
void test::print()
{
std::cout << "test ok" << std::endl;
}
//--------------------------end
test.cc----------------------------------------
thanks a lot for your answers!!!! ;-)
cedric
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]