Archive for August, 2007

Install PHP-GTK2 on windows - now as easy as 1-2-3

Thursday, August 30th, 2007

Thanks to the note from Robert Clancy of Australia. I re-looked at my original article on “How to install PHP-GTK2 on windows”. Yes, it’s a bit messy and not too clear.

I did another round of tests of the various windows installation packages available, and found the beta release available from the official PHP-GTK2 website the easiest to install.

Setting up PHP-GTK2 on windows is now literally as easy as 1-2-3! All you need is to download a zip file - unzip - and off you go!

If you have encountered a lot of problems trying to install PHP-GTK2 on windows previously, please try it one more time. If you’re already familiar with PHP, you should give PHP-GTK2 a try. It’s a lot of fun. Not to mention it’s power!

So, here’s the revised article:
How to install PHP-GTK2 on windows

/kksou

http://www.kksou.com/php-gtk2
The place for php-gtk2 sample codes

Remove nodes from a treestore

Tuesday, August 28th, 2007

In case you need to remove nodes from a GtkTreeStore, here are three sample codes:

How to remove nodes from GtkTreeView - Part 1?

How to remove nodes from GtkTreeView - Part 2 - highlight remains?

How to remove nodes from GtkTreeView - Part 3 - remove child nodes only?

Of particular interest is the use of the “additional GtkTreeModel functionality” implemented by Andrei Zmievski. If you have not tried this before, you should. It’s a technique that will be very useful in some applications.

/kksou

http://www.kksou.com/php-gtk2
The place for php-gtk2 sample codes

new book: PHP-GTK2 Cookbook Vol.1 - GtkTreeView

Wednesday, August 22nd, 2007

There have been numerous requests to have the sample codes on this website compiled into one single pdf.

So here it is - the first one of them: PHP-GTK2 Cookbook Volume 1 - GtkTreeView.

PHP-GTK2 Cookbook Vol1 - GtkTreeView

Highlights of the book:
* 84 recipes of PHP-GTK2 JUST ON GtkTreeView - from basic to advanced!
* Included 9 Advanced Recipes from members-only site.
* No ads. No side bars. Just the sample codes.
* Save time. Save paper. Save the trees.
More information here:
http://www.kksou.com/php-gtk2/ebooks/ebook02/

/kksou

http://www.kksou.com/php-gtk2
The place for php-gtk2 sample codes

Set up combobox in treeview with options in colored background

Monday, August 20th, 2007

Andre Colomb sent me a very interesting and useful sample code.

Quoted from his email:
“I’ve been trying to mess around with GtkCellRendererCombo some more. In my application, there are several combo boxes to select a value between 1 and 10. For the user to see which is good and which is bad, I set the background color for each cell in the combo box accordingly–which works perfectly. I added another column in the combo model holding the
color and change the background using a callback set with GtkCellLayout::set_cell_data_func().”

His sample code produces this:
0303.1.gif

Cool, isn’t it?

Here are the sample codes contributed by Andre Colomb:

How to set up combobox in treeview with colors - Part 1?

How to set up combobox in treeview with colors - Part 2?

/kksou

http://www.kksou.com/php-gtk2
The place for php-gtk2 sample codes

PHP-GTK Explorer v1.02

Friday, August 17th, 2007

Have just released PHP-GTK Explorer v1.02.

Thank you for those who have given me encouraging feedback. Glad some of you find this tool useful.

Also, sincere thanks to those who informed me of the bugs they have found. Please keep this flowing so that I can improve on this tool.

This version fixed three bugs reported by Luis and Fernand:

  • Reported by Luis Martinez Ulloa (15 Aug 2007)
  • Middle-click on signals doesn’t launch the right PHP-GTK2 man page.

    Status: fixed.

  • Reported by Luis Martinez Ulloa (15 Aug 2007)
  • Middle-click on empty areas on left pane or right pane will kill the application.

    Status: fixed.

  • Reported by Fernando Correa Da Conceição from Brazil (15 Aug 2007)
  • The application doesn’t work on new cvs of PHP-GTK2 because there is a recent change on cvs and some constants named Gtk:: were changed to GObject.

    Status: fixed.

I’m now working on the code to have the next version include searching for methods. For example, next time you can search for set_size_request() and it will automatically show GtkWidget on the left pane and set_size_request() on the right pane.

If you have any other feature request, please feel free to let me know (via email or feedback form).

/kksou

http://www.kksou.com/php-gtk2
The place for php-gtk2 sample codes

Radio buttons in GtkTreeView using GtkCellRendererToggle

Friday, August 17th, 2007

I think a lot of you have used GtkCellRendererToggle to display checkbox in a treeview.

However, do you know that GtkCellRendererToggle can be used to display radio buttons in a treeview too?

Have come out with 4 examples to illustrate this:

  1. How to set up radio buttons in GtkTreeView using GtkCellRendererToggle - Part 1 - one radio button? 08/17/2007
  2. How to set up radio buttons in GtkTreeView using GtkCellRendererToggle - Part 2 - three radio buttons? 08/17/2007
  3. How to set up radio buttons in GtkTreeView using GtkCellRendererToggle - Part 3 - process selections? 08/17/2007
  4. How to set up radio buttons in GtkTreeView using GtkCellRendererToggle - Part 4 - all radio buttons in one column? 08/17/2007

The last one is quite interesting, i.e. packing all the radio buttons and their corresponding labels into one treeview column. You could try this as an exercise. I learned a lot during the process of trying to get this to work.

/kksou

http://www.kksou.com/php-gtk2
The place for php-gtk2 sample codes

Introduction to Glade for PHP-GTK2

Sunday, August 12th, 2007

I’ve just released my second ebook. This one is on Glade, titled “Introduction to Glade for PHP-GTK2″.

I did a thorough search on the internet. There doesn’t seem to be a really good guides or tutorial for someone new to Glade/PHP-GTK. Most of them assumes some knowledge in GTK+.

Currently the best tutorial for Glade/PHP-GTK2 is still the one on the offical PHP-GTK website: http://gtk.php.net/manual/en/tutorials.helloglade.php

This ebook picks up where the tutorial stops, going beyond “hello world” and introduceing some of the key concepts of PHP-GTK2 that are required in order to use the Glade tool.

You would have probably noticed by now. None of the sample codes on this website uses Glade. It’s not that I don’t like Glade. In fact, I encourage you to use Glade.

I’m one that believes in learning the fundamentals. Once you understand the how’s and why’s in PHP-GTK2, it’s easy to convert the code to using PHP-GTK2 + Glade.

After you’ve read Chapter 10 of the book, you will find that it’s really easy to convert almost all the 350+ sample codes in this website to using Glade.

You can find more information about the book here: Introduction to Glade for PHP-GTK2

/kksou

http://www.kksou.com/php-gtk2
The place for php-gtk2 sample codes

php-gtk2 + glade2

Friday, August 3rd, 2007

There have been numerous requests to have more examples using glade2.

So I’m working on my second book on php-gtk2 + glade2. Should be ready by the end of this month.

Hope this book, together with the more “user-friendly” glade tool, will encourage more people to move to php-gtk2.

/kksou

http://www.kksou.com/php-gtk2
The place for php-gtk2 sample codes