GtkListStore::insert

GtkTreeIter insert (int row [, array items ]);

Inserts a new row at the given position and returns the iterator for that specific row. After that, you can set the row data via set() method.

You can pass an array with the complete row data as second parameter, which automatically sets the data for you. The size of the array has to match the number of columns in the store, and the type as to be equal to the corresponding column type.

Example 96. Inserting some rows into a list store

<?php
//Create new store with two columns
$store = new GtkListStore(Gobject::TYPE_STRING, Gobject::TYPE_LONG);

//insert the rows at different positions
$store->insert(1, array('Tokio', 34100000));
$store->insert(0, array('Mexico city', 22650000));

//use the iterator to set the data after insertion
$iter = $store->insert(1);
$store->set($iter, 0, 'Seoul', 1, 22250000);
?>