Re: TreeView - First element



Dear Daniel,

    I think the problem is that iter_swap() does not work for a sorted
liststore. So don't do this:
model->set_sort_column(...);

2nd Method (not using Gtk::TreePath):
void move_down()
{
	Gtk::TreeIter iter_selected = view->get_selection()->get_selected();
	if (!iter_selected)
		return;
	
	Gtk::TreeIter iter_next = iter_selected;
	++iter_next;
	if (iter_next == model->children().end()) // only 1 row in model!
		return;
	
	
	// iter_swap() only works for an unsorted liststore; otherwise you will get:
	// Gtk-CRITICAL **: gtk_list_store_swap: assertion `!GTK_LIST_STORE_IS_SORTED
(store)' failed
	model->iter_swap(iter_selected, iter_next);
}

Regards from so sui ming



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]