GtkListStore::swap
Swaps rows a and b in the list store. Note that this function only works with unsorted stores.
<?php
$store = new GtkListStore(Gtk::TYPE_STRING, Gtk::TYPE_LONG);
//insert the rows at different positions
$tokio = $store->insert(0, array('Tokio', 34100000));
$mexico = $store->insert(1, array('Mexico city', 22650000));
//we swap so that mexico is first
$store->swap($tokio, $mexico);
//show the list
function echoRow($store, $path, $iter) {
echo $store->get_value($iter, 0) . "\r\n";
}
$store->foreach('echoRow');
?> |