PHP-GTK
Monday, September 22, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousSummary
Signalsnext

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

This tutorial will deal with the concept of signal handling in PHP-GTK 2 which is an important and fundamental, since this is what makes your application "tick"!.

You might have noticed that at the end of every PHP-GTK 2 program we write this statement:

Gtk::main();
What this means is that an infinite loop is started which waits for something to occur. Obviously you do not want to just create, display widgets and quit! This loop is what keeps that from happening and is the key to keep your application running. Conversely, the statement:
Gtk::main_quit();
exits from that loop. We use this whenever we really want to stop our application.

First, it will be useful to define some terms that we will use frequently.

Signal handling basically consists of connecting a signal to its signal handler, and of course, writing the signal handler itself. The job of generating the signal whenever an action occurs is taken care by PHP-GTK 2. Another thing to note is that signal generation does not guarantee that the user has performed some action. It is possible to manually generate a signal, and PHP-GTK 2 generates signals internally all the time.

A common instance of a signal being internally generated and used is when GtkAdjustment emits the "value-changed" for a GtkProgressBar to use it. Hence, some signals have a default handler already inbuilt, which will be executed whether or not you manually connect a signal handler to that signal.

Most of the times however, if you want something to happen when a signal is generated, you need to create a signal handler for it.


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


previousSummary
Signalsnext

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