treeview drag'n drop



Hello

I use a treeview with a liststore in my app and I would like it to be
reorderable with drag'n drop.

There is little doc about how to do this, so I tried this:

construct everything...
make the view reorderable

gtk_tree_view_set_reorderable(selfp->view, TRUE);

use these funcs:

gtk_tree_view_enable_model_drag_source (selfp->view, GDK_BUTTON1_MASK,
        target_table, G_N_ELEMENTS(target_table),
        GDK_ACTION_MOVE|GDK_ACTION_COPY);
gtk_tree_view_enable_model_drag_dest (selfp->view,
        target_table, G_N_ELEMENTS (target_table),
        GDK_ACTION_MOVE|GDK_ACTION_COPY);

the target_table looks like this:

static const GtkTargetEntry target_table [] =
{
        { "STRING",        0, TARGET_STRING },
        { "text/plain",    0, TARGET_STRING },
        { "text/uri-list", 0, TARGET_URL },
        { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, 0 }
};

what happens with this?

I can drag a row and the view shows where it would be dropped, but when
dropped everything remains the same.

Help!

A second question:

can I make it drag the whole selection at once? (yes SELECTION_MULTIPLE
is enabled).

Thank you,

-- 
 el greco  <<<<<<
---------------------------------------------
StÃphane K. -----> http://brain.shacknet.nu |
---------------------------------------------

Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=



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