[gtkmm] Connecting signals to class methods
- From: Rus Hughes <rus carpathia force9 co uk>
- To: gtkmm-list gnome org
- Subject: [gtkmm] Connecting signals to class methods
- Date: 02 Jan 2003 22:39:59 +0000
Sorry for posting twice, but I screwed up the Subject line and feared
this post would get overlooked :/
hi, im having trouble with connecting signals with an app im writing and
would appreciate any help. In the following code I have an Engine class
which starts an instance of my playlist class. Id like the signals in
the playlist class to call methods in my Engine class. I am calling the
handler method after the engine is constructed which is where i intend
to connect the signals. The remmed out line works, but it only connects
to a function, whenever I try to connect to one of Engine's methods, I
get the following error :
/usr/include/sigc++-1.2/sigc++/object_slot.h: In method
`SigC::ObjectSlotNode::ObjectSlotNode<Engine, void (Engine::*)()>(void
(*)(void *), Engine *, void *, void (Engine::*)())':
/usr/include/sigc++-1.2/sigc++/object_slot.h:65: instantiated from
`SigC::slot<void, Engine, Engine>(Engine &, void (Engine::*)())'
engine.cc:21: instantiated from here
/usr/include/sigc++-1.2/sigc++/object_slot.h:35: no matching function
for call to `SigC::ObjectSlotNode::init (Engine *&, void *&, void
(SigC::Object::* &)())'
/usr/include/sigc++-1.2/sigc++/object_slot.h:36: candidates are: void
SigC::ObjectSlotNode::init(SigC::Object *, void *, void
(SigC::Object::*)())
Please could someone help me overcome it so I can connect to methods in
the Engine class?
Thanks in advance
Rus
#include <iostream>
#include "engine.hh"
void test() {
cout << "open";
exit(1);
}
Engine::Engine() {
gorecki=new class Gorecki();
playlist=new class Playlist();
}
void Engine::open() {
cout << "open";
}
void Engine::handlers() {
//playlist->button5->signal_clicked().connect( SigC::slot(&test) );
playlist->button5->signal_clicked().connect(
SigC::slot(*static_cast<class Engine*>(this), &Engine::open) );
}
--
Rus Hughes <rus carpathia force9 co uk>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]