Re: slots & callbacks



>    I sent to this to the gtkmm list and the libsigc list, but no one has
> been able to help. This post isn't really C++-centric. It has more to with
> slots and callbacks.
>    I created a ComboWCB class with
> a member function called Callback. This class is derived from the
> Combo class. I then write:
> 
> ComboWCB *NewCombo = manage(new ComboWCB);
> ...
> NewCombo->get_popwin()->unmap_event.connect(
> slot(NewCombo, &ComboWCB::Callback) );
> 
> The prototype for ComboWCB::Callback is as follows:
> void Callback(GdkEventAny *Event);

The prototype of your function and the signal do not match
thus the connection can not be completed.  Change the 
callback declaration.

>    I get an error on the last line. The compiler complains that
> there is no matching function: no matching function for call to

You have a very crappy compiler for generating error messages...
here let me reduce the error make it more clear.
 
 'Gtk::EmitProxySignal1<int,_GdkEventAny*>::connect (Slot1<void,_GdkEventAny*>
)'
 /usr/local/include/gtk--/proxy.h:208: candidates are:
  Gtk::ProxySignal1<int, _GdkEventAny*>::connect(const Slot1(int,_GdkEventAny 
*> &)

Thus you are passing a Slot1<void,GdkEventAny*> and it wants a
Slot1<int, GdkEventAny*>.  Thus you should change your callback
to return an int.

Hope it helps.

--Karl






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