Re: TreeView - First element




        if (ListTreeModel->children().end() != iter)
            ListTreeModel->iter_swap(iter, iter++);

Not sure, but I think children().end() is one past the last element so when you select the last element in the treeview "ListTreeModel->children() != iter" is true but "iter++" is not a valid iter. Can you try with this?:

void fun::fun_move_down()
{
    if (!ListTreeView.get_hover_selection())
    {
        Glib::RefPtr<Gtk::TreeSelection> ref = ListTreeView.get_selection();
        Gtk::TreeModel::iterator iter = ref->get_selected();
        Gtk::TreeModel::iterator other_iter = iter++;

        if (ListTreeModel->children().end() != other_iter)
            ListTreeModel->iter_swap(iter, other_iter);
    }
}


--
Atentamente:
Juan Ángel Moreno Fernández
jamf.gm@gmail.com
------------------------------
 Proyecto Gelide
 http://gelide.sf.net
------------------------------


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