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
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
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.