Re: problems with button_press_event
| From: | James Cameron | Date: | Wed, 26 Feb 2003 09:58:28 +0000 |
| Subject: | Re: problems with button_press_event | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-3067@lists.php.net to get a copy of this message | ||
On Wed, Feb 26, 2003 at 10:17:14AM +0100, bertrand de Baenst wrote:
> Whenever I click on a button with the left mouse button, it calls the
> function hello2(...), no problems.
> but then whenever I click on something else (anything from another button
> or even the menu bar) it just redoes the hello2(...) function all over
> again for the button I pressed before.
Yes, perfectly normal.
Check the $event->type for GDK_BUTTON_PRESS.
Other event types that you might get ...
GDK_BUTTON_PRESS = 4, mouse button down event
GDK_2BUTTON_PRESS = 5, mouse button down soon after another
GDK_3BUTTON_PRESS = 6, etc
GDK_BUTTON_RELEASE = 7, mouse button released event
(from gdktypes.h, with my comment)
You might even be getting other event types, depending on the way the
button widget internals are designed.
I wouldn't *expect* recursive behaviour, but you *have* to be prepared
for this, just in case. For example, assuming that a widget wants to
be told when part of it has been exposed, so that it can redraw that
part, and assuming you change the state of the widget ... you may end
up being called recursively. This is not a problem though, because the
event types are different.
--
James Cameron mailto:quozl@us.netrek.org http://quozl.netrek.org/