Forum und email

GtkTreeStore::iter_is_valid

bool iter_is_valid(GtkTreeIter iter);

Returns true if the given iterator points to a row that exists in the model.

An iterator can get unvalid by removing it (or one of its parents) from the tree.

例 129. Checking an iter's validity by using iter_is_valid()

<?php
//Create the store
$store = new GtkTreeStore(Gtk::TYPE_STRING);

//add a row and save the iter into $row
$row = $store->append(null, array('row'));
//that should return true, as the row exists
var_dump($store->iter_is_valid($row));

//remove that row from the store
$store->remove($row);
//shouldn't be valid any more
var_dump($store->iter_is_valid($row));
?>