Re: GtkTreeView - drag & drop



Thanks for your help I'd completely missed gtk_tree_view_set_reorderable
and it does what I wanted apart from the ctrl to copy - perhaps I'll do
that with a "duplicate selected item" button and then have the user use
drag and drop to put the newly created item where he/she wants it.

Now wrestling with GtkCellRendererCombo and GtkCellRendererSpin if
anyone can give me a few tips in their usage I'd be grateful also.

On Tue, 2008-12-09 at 12:58 +0100, Tadej BorovÅak wrote:

Hello.

I'm far from expert at those things, but to achieve simple reordering,
I think it's enough to call gtk_tree_view_set_reorderable on your
GtkTreeView (if you created custom tree store for your treeview, you
need to implement GtkDragSource and the GtkDragDest interfaces in it
to make things work). Using this method also disables all other DND
activities (you cannot drag rows to other widgets).

To implement "copy when Ctrl is pressed" behavior, you'll need to look
at the API for DND. See docs for more info (there is not much info,
but still better than nothing;):
http://library.gnome.org/devel/gtk/stable/gtk-GtkTreeView-drag-and-drop.html

I'll play around a bit and see what can I work out.


2008/12/9 John M Collins <jmc xisl com>:
Could a kind person point me at some specimen code to do drag & drop
with a GtkTreeView? The Tree View tutorial fizzles out on that issue.

All I want to do is let the user use the mouse to shuffle round the
order of items in a list - I don't require to drag anything to another
widget in fact I want to ban that if possible.

It would be nice if I could have the user hold down the CTRL key to mean
"copy" rather than "move" - is there any way of doing that?

Thanks for any help.


John Collins Xi Software Ltd www.xisl.com


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





John Collins Xi Software Ltd www.xisl.com





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