Re: Timer gives up




Stephen Birch <sbirch@ironmountainsystems.com> writes:

> I'm not sure if I have misunderstood the purpose of the timer, but it
> doesn't seem to keep calling my callback function.  Oddly, if I put a
> print statement inside the callback it seems to repeat just fine.
> 
> Is there some fundamental item I have missed?

Yes. ;-)

gint	   gtk_timeout_add	   (guint32	   interval,
				    GtkFunction	   function,
				    gpointer	   data);

typedef gint (*GtkFunction) (gpointer data);
        ^^^^

If your function returns true, then the timer will be reinstalled.
If it returns false, it will only run once. If it returns 'void',
then you may get strange results  ... as you've noticed.

Regards,
                                        Owen



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