Re: Holding Down a Button
| From: | Christian Weiske | Date: | Thu, 02 Dec 2004 22:36:41 +0000 |
| Subject: | Re: Holding Down a Button | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5292@lists.php.net to get a copy of this message | ||
Hi Scott,
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
I want a value to be incremented while a user is clicks and holds down a button on a GtkButton. I am a little confused about how to do it though. Do I need to use gtk::events_pending and gtk::main_iteration_do? If so, how would I do that? Something like this?
$this->connect_object('button-press-event', array(&$this, 'incValue'), 5)
...
function incValue($value)
{
$this->value += $value;
while (gtk::events_pending()) {
gtk::main_iteration_do();
}
}
I don't see how that would keep incrementing unless the event is fired each iteration. Is that what happens?
You could start a timeout which calls the incValue as long the button is clicked. There is no way to get the event again and again - there is just one button press.
Regards/MfG,
Christian Weiske
--
XMMS is playing now:
Wir Sind Helden - Guten Tag
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc