PHP-GTK 2.0

Versions 2.0 alpha, beta, zeta ...

Extending GtkDrawingArea with OO methods

GxDrawingArea example This example shows a nice drawing area class, derived from GtkDrawingArea:

  • with 2D matrix transformation : rotate, translate, scale
  • with many classes : Point, Matrix, GxObject, GxPoint, GxRectangle, GxDrawingArea

Inspecting class methods

This examples shows how to discover on your own what the methods for a given widget are, from the actual current implementation, instead of relying on documentation. You can obviously use it to examine other classes, but this sample code shows the methods of classes Gtk and GtkWindow.

In addition, this example shows how to line up vertically by the top the contents of panes in a GtkHBox, just like vertical-align does in CSS. In this example, we use it to align the two lists because they are of very different lengths.

Linuxstok - CRM

LinuxStok "Controle de Estoque e Financeiro" is software for managing the life of a commercial store. It is developed especially for the Brazilian market.

Simulating wait loops

How to use a loop, for you might want to make an IRC client :)

I had trouble finding this out, so here it is. If you want to manage a network connection (i.e. an IRC connection) you need a while (1) {} loop.

This cannot be done in PHP-GTK, because of the gtk::main() function. So, there is the gtk::timeout_add($time, $function) that executes a function every $time milliseconds. This solves our problem.

Important

Your function must return TRUE else it will not be called again. Return FALSE to cancel the timeout.

A landmark in PHP-GTK life

Andrei Zmievski, creator and lead coder of the PHP-GTK project, posted a long "letter to the community" today, which is poised to mark a turning point in the history of the project, after a long period of stagnation.

It is available on archive of the php-gtk-general mailing list, for instance on the MARC Archive.

Conteúdo sindicalizado