Re: Timeout problem
- From: Bob Caryl <bob fis-cal com>
- To: Jorge Villalobos Beato <tiusender gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: Timeout problem
- Date: Tue, 30 Aug 2005 16:30:30 -0500
Hola Jorge,
Here's how you want to do this:
bool Protocol::control_servidor(int timer_number)
{
// do something here
return true;
}
void Protocol::init_function()
{
sigc::slot<bool> my_slot = sigc::bind(sigc::mem_fun(*this, &Protocol::control_servidor),1);
sigc::connection conn = Glib::signal_timeout().connect(my_slot, 1500);
}
The Glib::signal_timeout function is looking for a callback slot that
has as its formal paramter an integer. Your Protocol::control_servidor
did not provide that and so the compiler complained.
I apologize for not looking closer at this before.
Bob
Jorge Villalobos Beato wrote:
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>
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]