RE: I can't figure out how to use Gtk::ListStore::move() and move a row to the end...



I forgot to say that "destination" is a private variable of my class of type "Gtk::TreeModel::Path";


From: sledgehammer_999 hotmail com
To: gtkmm-list gnome org
Subject: I can't figure out how to use Gtk::ListStore::move() and move a row to the end...
Date: Tue, 7 Dec 2010 23:03:44 +0200

I am subclasssing Gtk::ListStore and overriding Gtk::TreeDragSource::drag_data_delete_vfunc and Gtk::TreeDragDest::drag_data_received_vfunc.
In these methods I use Gtk::ListStore::move instead of Gtk::ListStore::insert/Gtk::ListStore::delete. The reordering of the rows works fine if the dragged row is position on any position except one corner case.  If the row is dropped at the end of the TreeView Gtk::ListStore::move fails with this message " Gtk-CRITICAL **: gtk_list_store_move_before: assertion `VALID_ITER (position, store)' failed"

Here is my code for my two overriden methods:

bool CustomListStore::drag_data_delete_vfunc(const Gtk::TreeModel::Path& path)
{
  Gtk::TreeModel::iterator dest, source;
  dest = get_iter(destination);
  source = get_iter(path);
  move(source, dest);
  destination.clear();
  return true;
}

bool CustomListStore::drag_data_received_vfunc(const Gtk::TreeModel::Path& dest, const Gtk::SelectionData& selection_data)
{
  destination = dest;
  return true;
}


received_vfunc always gets called before the delete_vfunc. Maybe, in my corner case, the Gtk::TreeModel::Path returned in the received_vfunc is not correct?

How should I proceed to solve my corner case?

_______________________________________________ gtkmm-list mailing list gtkmm-list gnome org http://mail.gnome.org/mailman/listinfo/gtkmm-list


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