php-library.com
 -Home
  
Documentation
-PHP Manual>
Table of contents
Copyright
Preface
Getting started
Language reference
Security
Features
Function reference
Zend API
PHP API:Interfaces for extension writers
FAQ
Appendixes

-Pear Manual>
Table of contents
Copyright
Preface
About this manual
Structure of manual
I) About PEAR
 1. Introduction
 2 Installation
 3 Support
 4 Coding standards
 5 Contributing
 6 FAQ
II) Developer Guide
 7 Introduction
 8 PEAR's meaning for developers
 9 Contributing your own code
 10 The package definition file package.xml
 11 Releasing a package
 12 Supporting PEAR development
III) Core components
 13 PEAR base classes
 14 PPM classes
IV) Packages
 15 Authentication
 16 Benchmarking
 17 Caching
 18 Configuration
 19 Console
 20 Database
 21 Date & time
 22 Encryption
 23 File formats
 24 File System
 25 HTML
 26 HTTP
 27 Images
 28 Logging
 29 Mail
 30 Math
 31 Networking
 32 Numbers
 33 Payment
 34 PEAR
 35 PHP
 36 Science
 37 System
 38 Text
 39 XML
V) PECL packages
 I. Advance PHP debugger
 II. PHP bytecode compiler
 III. Imagick
 IV. KADM5
 V. Radius
 VI. Paradox file access
 VII. Satellite CORBA client extention
 VIII. PostgreSQL session save handler
 IX. Soap
 X. SPPLUS payment system
 XI. Net_Gopher
 XII. oggvorbis

-PHP-GTK Manual>
Table of contents
Copyright
Preface
PHP-GTK userguide
I) Introduction to PHP-GTK
 1. What is PHP-GTK?
 2. What is PHP?
 3. What is GTK+?
 4. Acknowledgements
II) Getting started
 1. Getting the lastest version
 2. Installing PHP-GTK under Windows
 3. Installing PHP-GTK under Unix
 4. How to use PHP-GTK
III) Basic elements
 1. Widgets & containers
 2. Signals & callbacks
PHP-GTK tutorials
I) Hello world tutorial
PHP-GTK reference
I) GTK classes
II) GDK clasesse
III) GTK enums
IV) GDK enums
V) Glade classes
VI) Scintilla classes
Appendix
I) PHP-GTK credits
II) PHP-GTK documentation credits
III) GNU free documentation license
IV) Symbolic names for keys in PHP-GTK
 
More stuff here
 -Contact Us
 -Links
 -
Sitemap
 
 
 
 

When you begin to learn a programming language, the first program you often write is a 'hello world' program. So, just to fit in with everyone else, the first tutorial in this manual just happens to be a 'hello world' tutorial!

Throughout the tutorials we expect a reasonable grasp of PHP itself. The tutorials are designed to give the user an idea of how to use PHP-GTK, and the ideas and techniques behind it.

In this tutorial we will create a simple window with the text "Hello World!" in it.

We will start by listing the program and will then explain each line of the program, giving an overview of a very basic PHP-GTK application.

These first few lines check to see if the PHP-GTK extension is already available, and loads it if it isn't. This is done by the dl('php_gtk.dll'); or dl('php_gtk.so'); statements on Windows and Linux respectively.

The delete_event() function is registered as a handler (see below) for the "delete-event" signal. It returns false, telling PHP-GTK to fire the event's default signal handler, which in this case is the destroy() method. If the function were to return true, PHP-GTK would stop the default signal handler running at this point. This is useful to know if you need to write a user-defined function in place of destroy() - for example, to produce a dialog box confirming that the user intends to close down the application.

It is not strictly necessary to return false in order to connect the "delete-event" signal to the destroy() method, as this particular signal returns false by default. It is possible to not specify any behaviour at all for a window's "delete-event" signal, just so long as the "destroy" signal is handled in the correct way, as it is here.

The shutdown() function is registered as a handler for the "destroy" signal. The function prints the text "Shutting down...\n" to the console and then calls the static function gtk::main_quit() .

The hello() function is registered as a handler for the "clicked" signal on the button. It globalises the $window variable so it can access the instance of GtkWindow created further down the script. It then prints the text "Hello World" to the console before calling the destroy() method on the window, which in turn fires the "destroy" signal, which in turn calls the shutdown() function.

Another way that the hello() function would be able to access the $window variable is if the variable were passed as a custom parameter.

The next four lines set up the window itself. Firstly we create an instance of GtkWindow. Once this has been done successfully, we call the connect() method from the window in order to register the shutdown() function as the handler for the "destroy" signal and the delete_event() function as the handler for the "delete-event" signal. Finally, we call the set_border_width() function to set a 10-pixel wide border on the instance of GtkWindow that we just created.

These three lines of the script create and set up the button. In the first line of the above code snippet we create a new instance of the GtkButton widget. The argument to the constructor is the text we want the button to display - in this case "Hello World!". We then call the connect() method to register the hello() function we defined earlier, as the handler for the "clicked" signal. Finally we add the button to the window we previously created by calling the GtkContainer method add() from our containing $window, and then display everything contained by $window (and its child widget, $button) by calling the show_all() method, also from our instance of GtkWindow.

The final line of the script calls the static gtk::main function. This tells PHP-GTK that we have finished setting up our interface, and that the main loop can begin listening for the events fired by user interaction so that the callback functions we defined earlier can be called and the various actions carried out.

 
Network Sites
Domain registration : Register domain name from $5.95
Domain name registration or transfer domain name from $5.95/yr. Includes comprehensive free services such as URL/Email forwarding.
Website hosting : cheap web hosting from $8.95
Website hosting service for single or multiple domain names for as low as $2 per domain.
Cheap domain name registration by cheap domain registrar
Domain name registration and transfer service by Cheap Domain Name Registrar.

 


www.PHP-library.com