On Mon, 6 Jan 2003 03:00:43 +0100 447158 celes unizar es wrote:
Hi, I'm programming an application using GTK+1.2. I have to execute a procedure (for instance as a callback when clicking on a "start" button) and then I'd like to be able to stop it whenever the user gets bored (for instance by having another button "stop"). However I suppose that if a callback procedure is executed it cannot stop and of course it would not allow the application to catch new events till it's finished, or yes?
If it can take long enough for the user to get bored, it should _not_ be a callback. Callbacks are supposed to run and return quickly. If you want to do a timeconsuming procedure, chop the work up in littel pieces and do a small piece of the work in a timeout function. You can then also do things like update a status-bur at the end of each timeout run, and have a global variable (set by the stop button) that stops the timeout. Roland -- R.F. Smith /"\ ASCII Ribbon Campaign r s m i t h @ x s 4 a l l . n l \ / No HTML/RTF in email http://www.xs4all.nl/~rsmith/ X No Word docs in email / \ Respect for open standards
Attachment:
pgpXq522J8u3n.pgp
Description: PGP signature