Re: PHP-GTK in PHP Magazine [Re: PHP-GTK in PHP|A]

From: Date: Wed, 01 Sep 2004 12:55:14 +0000
Subject: Re: PHP-GTK in PHP Magazine [Re: PHP-GTK in PHP|A]
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-5023@lists.php.net to get a copy of this message
Ben Ramsey wrote:
However, I did mention this on my blog, and I should've posted it to this list. My article on PHP-GTK, titled "Making a GUI Mess of PHP," is in the current (05.2004) issue of PHP Magazine. You can find out more about it at the following two links (unfortunately, the article is not offered on-line): http://blog.benramsey.com/2004/08/19/php-gtk-article/ http://www.phpmag.net/itr/ausgaben/psecom,id,212,nodeid,112.html Feel free to point out any errors. I would've like to have let Andrei or Steph read it first and do a bit of technical editing for me, but I was pushing the deadline as it was.
Hi Ben, I just got my issue of php-mag today (yeah free magazines!) and I am reading over your article. Its great article but I have a few comments. First, what's with the jab about documentation? We are working on it give us some time :) On a more serious note, your section about event wrangling is a little confusing. You say that inorder to pass an object method to a call back you have to use array(&$obj, 'method') and connect_object(). The first part is correct but the part about connect_object isn't. The array syntax is how you pass an instance method to a call back in any PHP code not just PHP-GTK. It works the same in connect() as it does in connect_object(). The difference between connect() and connect_object() is that connect_object() can pass a different widget to the call back than the widget that fired the event. connect_object() takes a third parameter, the widget to pass to the call back. If you use connect_object() you don't have to declare any globals in your function and you can use the function for more than one widget. I haven't looked at the source cd yet but I would assume that your select_all_text() function starts with 'global $textpad;' Using connect_object() it should look something like this: function select_all_text(&$textArea) { // Select all text... $textArea->select(); // Or whatever the correct syntax is. } $select->connect_object('activate', 'select_all_text', $textpad); Overall though, it's a good article. I really enjoyed it. Thanks, Scott Mattocks

« previous php.gtk.general (#5023) next »