Re: TreeView - First element



My suggestion:

	Gtk::TreeIter iter_selected = view->get_selection()->get_selected();
	if (!iter_selected)
		return;

	// find index:
	Gtk::TreePath path = model->get_path(iter_selected);
	int index_selected = path[0];
	int max_index = model->children().size() - 1;
	if (index_selected == max_index) // only 1 row in model!
		return;


	// move to next row:
	path.next();
	Gtk::TreeIter iter = model->get_iter(path);
	if (!iter)
		return;


	model->iter_swap(iter, iter_selected);
	//or manually swap the rows...
	//(*iter).set_value(...)




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