Re: Enable drag and drop for treeview?



On 5/3/07, Jef Driesen <jefdriesen hotmail com> wrote:
Jonathon Jongsma wrote:
> On 5/2/07, Jef Driesen <jefdriesen hotmail com> wrote:
>> For my application, I want to be able to re-order rows in a treeview
>> (treestore model) using drag and drop. According to the gtkmm book, I
>> can use set_reorderable(). But how can I detect when a drag and drop
>> operation is finished (to update the underlying database)? I can't find
>> any signals to connect to. Am I missing something?
>
> What about Gtk::TreeModel::signal_rows_reordered() ?

How could I miss that one? But in the gtk documentation [1] is mentioned
that this signal is not emitted by drag and drop operations. I found an
old post on the gtk-perl mailinglist [2], that says this signal is only
used when sorting.

[1]
http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeModel.html#GtkTreeModel-rows-reordered
[2]
http://mail.gnome.org/archives/gtk-perl-list/2003-September/msg00197.html


hmm, OK.  I just checked a project of mine where I save the state of a
treeview when something is changed, and I handle the case of a
drag/drop re-order.  And the signals I connect to are
Gtk::TreeView::signal_drag_end() and
Gtk::TreeModel::signal_rows_reordered () and it seems to work fine for
my purposes.  So maybe the drag_end() one is the one you want?  Or
maybe Chris's suggestion is better.  I've not done extensive testing
on mine, so I'm not sure if there are cases that might not get caught,
but it seems to work for what I need it to do.
--
jonner



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