Re: How to start/stop animation?
- From: Paul Davis <paul linuxaudiosystems com>
- To: edward hage <edha xs4all nl>
- Cc: gtk-list gnome org
- Subject: Re: How to start/stop animation?
- Date: Wed, 19 Mar 2003 17:47:04 -0500
>I have made a little animation (oh, well .. it is a square bouncing). I
>do in the main-program:
[ ... ]
>I want to add a toggle-button with 'start' and 'stop'. I can create the
>buttons, that is no problem, but how can I make it stop/start the
>animation. I can terminate the
>gtk_timeout_add bij returning Repaint with return (FALSE), but how would
>I start the animation again?
>
>Looking forward for your reactions. Edward Hage
your code is wrong on a deep level. you cannot draw from a timeout
function. you should instead called gtk_widget_queue_draw(), and put
the repaint code in the expose event handler.
your start/stop problem is handled by using a handler for the toggle
button. when its inactive and becomes active, your handler adds a new
timeout and tells the timeout handler to return TRUE. when its active
and becomes inactive, you can either:
* set the value that the timeout handler should return to FALSE
* call gtk_timeout_remove()
--p
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]