[prev in list] [next in list] [prev in thread] [next in thread]
List: gtkmm
Subject: RE: I can't figure out how to use Gtk::ListStore::move() and move a
From: sledge hammer <sledgehammer_999 () hotmail ! com>
Date: 2010-12-07 21:12:37
Message-ID: DUB102-w497D189DBDC2393507BEB6AB2C0 () phx ! gbl
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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
[Attachment #5 (text/html)]
<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
<font style="font-size: 12pt;" size="3">I forgot to say that </font><font \
style="font-size: 12pt;" size="3">"<font style="font-size: 8pt;" \
size="1">destination</font></font><font style="font-size: 12pt;" size="3">" is a \
private variable of my class of type "</font><font style="font-size: 12pt;" \
size="3"><font style="font-size: 8pt;" \
size="1">Gtk::TreeModel::Path</font>";</font><br><br><hr id="stopSpelling">From: \
sledgehammer_999@hotmail.com<br>To: gtkmm-list@gnome.org<br>Subject: I can't figure \
out how to use Gtk::ListStore::move() and move a row to the end...<br>Date: Tue, 7 \
Dec 2010 23:03:44 +0200<br><br>
<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="Generator" content="Microsoft SafeHTML">
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}
</style>
I am subclasssing Gtk::ListStore and overriding Gtk::TreeDragSource::<a \
href="http://library.gnome.org/devel/gtkmm/unstable/classGtk_1_1TreeDragSource.html#a34849cb405c5a97999f749a59c08cda3" \
class="ecxel" target="_blank">drag_data_delete_vfunc</a> and Gtk::TreeDragDest::<a \
href="http://library.gnome.org/devel/gtkmm/unstable/classGtk_1_1TreeDragDest.html#a61b2d071896c38c9b79b457f1a140ba9" \
class="ecxel" target="_blank">drag_data_received_vfunc. </a><br>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"<br><br>Here is my code for my two overriden methods:<br><br><font \
style="font-size: 8pt;" size="1">bool CustomListStore::drag_data_delete_vfunc(const \
Gtk::TreeModel::Path& path)</font><font style="font-size: 8pt;" \
size="1"><br></font><font style="font-size: 8pt;" size="1">{</font><font \
style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" \
size="1"> Gtk::TreeModel::iterator dest, source;</font><font style="font-size: \
8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1"> dest = \
get_iter(destination);</font><font style="font-size: 8pt;" size="1"><br></font><font \
style="font-size: 8pt;" size="1"> source = get_iter(path);</font><font \
style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" \
size="1"> move(source, dest);</font><font style="font-size: 8pt;" \
size="1"><br></font><font style="font-size: 8pt;" size="1"> \
destination.clear();</font><font style="font-size: 8pt;" size="1"><br></font><font \
style="font-size: 8pt;" size="1"> return true;</font><font style="font-size: \
8pt;" size="1"><br></font><font style="font-size: 8pt;" size="1">}</font><font \
style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" \
size="1"><br></font><font style="font-size: 8pt;" size="1">bool \
CustomListStore::drag_data_received_vfunc(const Gtk::TreeModel::Path& dest, const \
Gtk::SelectionData& selection_data)</font><font style="font-size: 8pt;" \
size="1"><br></font><font style="font-size: 8pt;" size="1">{</font><font \
style="font-size: 8pt;" size="1"><br></font><font style="font-size: 8pt;" \
size="1"> destination = dest;</font><font style="font-size: 8pt;" \
size="1"><br></font><font style="font-size: 8pt;" size="1"> return \
true;</font><font style="font-size: 8pt;" size="1"><br></font><font style="font-size: \
8pt;" size="1">}</font><br><br><br>received_vfunc always gets called before the \
delete_vfunc. Maybe, in my corner case, the <font style="font-size: 8pt;" size="1"> \
<font style="font-size: 10pt;" size="2">Gtk::TreeModel::Path returned in the \
</font></font><font style="font-size: 8pt;" size="1"><font style="font-size: 10pt;" \
size="2">received_vfunc is not correct? <br><br>How should I proceed to solve my \
corner case?<br></font></font> \
<br>_______________________________________________ gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list </body>
</html>
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic