Re: Preventing concurrent processing?
| From: | kksou | Date: | Thu, 08 Nov 2007 15:03:20 +0000 |
| Subject: | Re: Preventing concurrent processing? | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-8133@lists.php.net to get a copy of this message | ||
Benjamin Smith wrote:
> Say that there are two buttons on the screen, each of which take a few
> moments
> to process. If the user presses button A, and starts the process, and then
> presses button B before A's callback is done, then both callbacks
> are "running at the same time".
>
> This has resulted in some inconsistent states and program crashes. (EG:
> the
> callback for button A assumes that a certain object is defined, but since
> button B was pressed before A was done, that object is no longer there)
>
> Is this making sense? What's the best way to structure things to deal with
> this issue?
>
Hi Benjamin,
There are many ways to handle "concurrent" button clicks in PHP-GTK2. Below
are three of the methods:
Method 1: using GObject::block()
Method 2: using GtkWidget::set_sensitive()
Method 3: GObject::emit_stop_by_name()
Sample codes as follows:
http://www.kksou.com/php-gtk2/articles/prevent-concurrent-button-clicks---Part-1---using-block.php
http://www.kksou.com/php-gtk2/articles/prevent-concurrent-button-clicks---Part-2---using-set-sensitive.php
http://www.kksou.com/php-gtk2/articles/prevent-concurrent-button-clicks---Part-3---using-emit-stop-by-name.php
Regards,
/kksou
--
View this message in context: http://www.nabble.com/Preventing-concurrent-processing--tf4733989.html#a13648650
Sent from the Php - GTK - General mailing list archive at Nabble.com.