PHP-GTK
Thursday, December 18, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousConnecting the two
Summarynext

Last updated: Sun, 12 May 2013
view this page in English

There is a lot of difference between events and signals, and both of them are far from interchangeable.

A signal is emitted by an instance of a GtkObject in response to some action by the user or an instruction from a function or a method.

Events on the other hand, are a continual stream of impulses that communicate messages regarding the environmental changes in the underlying windowing system. These are rather low-level, that means that every small change in the environment counts as an event.

It is not possible to connect a callback to an event directly.

We had used the enter-notify-event signal in our previous example. But it certainly sounds like it should be an event, isn't it? Many of the events have important applications and it is often necessary to be able to connect callbacks to them. For this purpose, PHP-GTK 2 provides several signals known as event signals (such as enter-notify-event and leave-notify-event) that are actually wrappers over the events themselves. These are ways of describing events in terms of signals so that we can connects callbacks to them.

Whenever you require to capture an event, you would most probably find an equivalent signal to work with. In case you don't, it is possible for every widget that has its own GdkWindow to capture events relevant to it. For those widgets that don't have a GdkWindow, they must be encapsulated in a GtkEventBox to be able to capture events. Capturing an event is not an easy task, and is beyond the scope of this tutorial. Like I said before, you will mostly find an equivalent signal to work with anyway, so don't worry too much about events.


User Contributed Notes
tutorials.signals.events.php
add a note about notes
There are no user contributed notes for this page.


previousConnecting the two
Summarynext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:51:01 2013 CEST