Chapter 3 Signal Handling
|Written by kksou|
|Sunday, 13 April 2008|
What are Signals
Signals are the links between your php-gtk application and the user. Signals allow you to know when the user do something — clicked a button, pressed a key, inserted a character, deleted a row, selected an image, etc. Through signals, you are able to act accordingly based on user's actions.
Signals are like the newsletters or news feeds. There are millions of free newsletters and news feeds currently out there on Internet. You only subscribe to the ones you are interested, so that you will not be flooded with too much information.
Same for signals. Take a look at the PHP-GTK manual. There are hundreds of signals listed there. You probably do not need to be informed about all these signals in your application. You register with php-gtk which are the ones you're interested in with the connect() method.
Take a look again at the index of signals in the php-gtk manual. In php-gtk each signal is identified by a unique name. For example,
When you register a signal with connect(), you need to know the name of this signal and specify it as the first argument.
When you register a signal with connect(), you also specify the name of your callback function as the second argument. For example, after you have registered the 'click' signal with
Since the callback function is used to handle a signal, you will sometimes see a callback function being referred to as a signal handler.
|< Prev||Next >|