On 17 Jul 2009, at 19:33, andrei_c wrote:
> void Canvas::timer_cb(void *v)
> {
>   Canvas *c = (Canvas *) v;
>   c->redraw();
>   Fl::repeat_timeout(0.5,timer_cb,c); // 0.5 s delay
>   n_frames++;
>
>   if(n_frames > 10) // this should stop the animation but it doesn't
>     Fl::remove_timeout(timer_cb);
> }

Rather than calling Fl::remove_timeout() here, it would be better  
(and simpler!) to just *not* call Fl::repeat_timeout(0.5,timer_cb,c);  
above it...

Each timer only fires one time, so if you do not call  
Fl::repeat_timeout(...), the animation should stop.

-- 
Ian

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to