sexta-feira, 4 de maio de 2007

Woking with GtkTreeModel and GtkTreeStore

On this article you will learn how to create a PHP-GTK model to place your informations stored on database ,files, or in another data repository systems .

The technique is to use some specific widgts, allowing the system to work right.

I will make all this stuff using OOP on PHP5-GTK2 dev. based, so if you don´t know nothing about classes or object oriented programming, i recomend you to read a few thing about it (there´s enought documentation about it on Internet, use google and search 4 "php oop" , it will show a large list of related web sites).
I personally recommed you this :
http://www.phpfreaks.com/tutorial_cat/19/Object-Oriented-Programming.php

On first snippet i will dev. an basic example by using the widgets ,GtkListStore ,GtkTreeView and GtkRenderText.

Here´s the inheritance diagram used for this aplication





To make work go faster i will build a generic class to create the windows, using the inheritance GtkWindow and GtkVBox used as container




Save this file above as "class_window.inc"

and write the next class and check how the process to build the list was made.









Result of this code:





Example as shown on my book "PHP5-GTK2 - Criação de aplicações com interfáce gráfica"
























Sem comentários: