Timeout problem



Hi people. I'm trying to do a timer, so every 1500 miliseconds (1,5
seconds) I want the function 'control_servidor' to be called. This
function is declared as public in the class 'Protocol' ( bool
control_servidor(void); ), but I want to call the one within the current
object (a Protocol one), I mean, there's a function inside Protocol
which start the timer to call another function of the same object.

Reading the Gtkmm tutorial I found a chapter talking on that issue
(http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch17.html) and this is
what it says:

  // Creation of a new object prevents long lines and shows us a little
  // how slots work.  We have 0 parameters and bool as a return value
  // after calling SigC::bind.
  SigC::Slot0<bool> my_slot = SigC::bind(SigC::slot(*this, &TimerExample::on_timeout), m_timer_number);

  // This is where we connect the slot to the Glib::signal_timeout()
  SigC::Connection conn = Glib::signal_timeout().connect(my_slot, timeout_value);


This what I'm doing at this moment, with 'timeout_value' equals to 1500
and no 'm_timer_numer', because my function waits for no arguments.
Doing the replacing, this is what I get:

bool Protocol::control_servidor(){
    //...
    return true;
}

void Protocol::init_function(){

    //...

    SigC::Slot0<bool> my_slot =  SigC::bind(SigC::slot(*this,
&Protocol::control_servidor));   //line 193
    
    Glib::signal_timeout().connect(my_slot, 1500);

    //...
}

When compiled, got this error:

protocol.cc:193: error: no matching function for call to
`slot(Protocol&, bool (Protocol::*)())'

Does anyone know what I'm doing wrong??

Thanks a lot

----------------
Jorge Villalobos Beato
<tiusender gmail com>
<tiusender.blogspot.com>



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