Re: [sigc] Is possible conect a signal to a variable?





On Fri, May 7, 2010 at 10:08 AM, VinIPSmaker <vini ipsmaker gmail com> wrote:
I'm still a newbie in libsigc++ and I wanna know if it's possible connect a signal that emit such as a int to a int variable, then, when the signal is emitted, the variable value is changed.

the value(s) received by the signal handler ("the slot" in sigc++ terminology) is/are the value passed to the signal emit call. if you want to attach *extra* values you use sigc::bind when connecting the slot and signal, but the value(s) you bind are fixed at bind time (they could be pointers, of course).

sigc::signal<void> aSignalWithNoArguments;
void handler_expecting_one_int (int foo):
.,...
aSignalWithNoArguments.connect (sigc::bind (sigc::ptr_fun (handler_expecting_one_int), 10);
....
aSignalWithNoArguments() // will call handler_expecting_one_int() with the value 10



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