PHP
  Home arrow PHP arrow Page 6 - Revisited: Building Cross Platform GUI App...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Revisited: Building Cross Platform GUI Apps With PHP-GTK
By: Mitchell Harper
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 9
    2002-11-17

    Table of Contents:
  • Revisited: Building Cross Platform GUI Apps With PHP-GTK
  • What is PHP-GTK?
  • Downloading and installing PHP-GTK
  • Installing PHP-GTK for Linux
  • Building our first PHP-GTK app
  • Registering multiple callback functions
  • Adding GTK widgets to our window
  • Other PHP-GTK widgets
  • A PHP-GTK database app
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Revisited: Building Cross Platform GUI Apps With PHP-GTK - Registering multiple callback functions


    (Page 6 of 10 )

    One of the great things about PHP-GTK is that you can register multiple callback functions for any signal. This can come in handy when you need to perform multiple tasks when a button is clicked, a window is closed, a tree is expanded, etc.

    Let's take a quick look at how to register multiple callback functions for the destroy signal of our window that we created above in window.php:

    // Set a callback function for the destroy signal

    $window->connect("destroy", "function1");

    $window->connect("destroy", "killwin");

    function function1()

    {

    echo("This is some output before the killwin function is called.\n");

    }

    function killwin()

    {

    echo("Window Destroyed!\n");

    gtk::main_quit();

    }


    As you can see, i've added another call to our windows connect function, specifying that it should also call the function1 function when it is destroyed. I've placed the call to connect("destroy", "function1") before the call to connect("destroy", "killwin"). This is an important point to remember: the order in which you register the callback functions is the order in which they will be executed.

    The output to my console window from running window.php with the new callback handler and function looks like this:

    C:\>php -q window.php

    This is some output before the killwin function is called.

    Window Destroyed!

    More PHP Articles
    More By Mitchell Harper


     

    PHP ARTICLES

    - Making Usage Statistics in PHP
    - Installing PHP under Windows: Further Config...
    - File Version Management in PHP
    - Statistical View of Data in a Clustered Bar ...
    - Creating a Multi-File Upload Script in PHP
    - Executing Microsoft SQL Server Stored Proced...
    - Code 10x More Efficiently Using Data Access ...
    - A Few Tips for Speeding Up PHP Code
    - The Modular Web Page
    - Quick E-Commerce with PHP and PayPal
    - Regression Testing With JMeter
    - Building an Iterator with PHP
    - PHP Frontend to ImageMagick
    - Using PEAR's mimeDecode Module
    - Incoming Mail and PHP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek