PHP-GTK
Saturday, August 23, 2014 
download | documentation | applications | faq | changelog | resources 


search for in the  


previousGtkTreeStore Constructor
GtkTreeStore::clearnext

Last updated: Sun, 12 May 2013
view this page in English

GtkTreeStore::append

GtkTreeIter append([GtkTreeIter parent, array items]);

Creates a new line and appends it to the end of the store. The first parameter parent can be null. If that's the case, the new entry will have no parent and thus be a "root" entry.

The second parameter items is an array with a value for each column. If your treestore has three columns, the array should have three values.

The method returns a GtkTreeIter which you can use to refer to the entry row; e.g. to use it as a parent for another row.

If you pass no parameters at all, an empty row with no values will be created, and you have to use other methods like set() to change the column values.

Example 131. Creating and filling a GtkTreeStore

<?php
//new model with just one column of type string
$store = new GtkTreeStore(Gtk::TYPE_STRING);
 
//create root entry: parent parameter is NULL
$root = $store->append(null, array('This is the root'));
//Create a child entry below the root one
$child = $store->append($root, array('Child of root'));
//Create a second child of root
$store->append($root, array('Second child'));
 
//create another root entry
$root2 = $store->append(null, array('Another root'));
 
//create empty root entry
$empty = $store->append();
//create empty entry below child
$subchild = $store->append($child);
 
//Display the store
$wnd  = new GtkWindow();
$view = new GtkTreeView($store);
$view->append_column(
    new GtkTreeViewColumn('String column', new GtkCellRendererText(), 'text', 0)
);
$wnd->add($view);
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));
$wnd->show_all();
Gtk::main();
?>

See also: insert() , insert_after() , insert_before() , prepend()


User Contributed Notes
gtk.gtktreestore.method.append.php
add a note about notes
There are no user contributed notes for this page.


previousGtkTreeStore Constructor
GtkTreeStore::clearnext

Last updated: Sun, 12 May 2013
view this page in English


credits 

PHP  Copyright © 2001-2014 The PHP Group
 All rights reserved.
Last updated: Sun May 12 20:51:01 2013 CEST