Re: Enable drag and drop for treeview?



On Wed, 2007-05-02 at 16:27 +0200, Jef Driesen 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?

I connect to the row_deleted signal on the tree view for this purpose,
as it is the last signal that the tree view calls after completing the
drag and drop on its rows.  I have had problems with some of the other
related signals (I think row_reordered may possibly have been one of
them) because with a number of them the signal is called before the row
to be deleted on the move has been deleted, so if you want to record the
state of the tree view it will not be in its final state - in particular
I had the problem of recording the same row twice, in both its new and
old position.

Anyway, test and see - as I say I settled on the row_deleted signal as
the one which worked for me.

Generally I do not use the specific tree view drag and drop functions
anyway, because of their limitations.

Chris





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