Re: [gtkmm] Connecting signals to class methods



Really this question would be better on the libsigc++ list, but anyway...


> Please could someone help me overcome it so I can connect to methods in
> the Engine class?

Your example code doesn't show the definition of the Engine class - are you sure you are deriving from SigC::Object?

>   gorecki=new class Gorecki();
>   playlist=new class Playlist();        

rather than new class Gorecki(); you should write new Gorecki; (but this won't
be your problem here.)

> 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) );

You shouldn't need that static_cast, once you're deriving Engine from
SigC::Object, SigC::slot(*this, &Engine::open) should be fine.

See the tutorial on the libsigc++ website for more examples.

Hope this helps,
~Ainsley.

-- 
 ----------------------------------------------------------
  / Ainsley 'Marble' Pereira / http://www.snowplains.org /
 / Don't drink and drive.



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