Re: Drag and drop mysteries



On Tuesday 17 May 2005 21:43, Matthias Kaeppler wrote:
> Hello,
>
> I want to implement drag and drop for my filemanager application. I have
> two treeviews of the filesystem, now I want to be able to drag e.g. a
> file from the left to right, but the drag and drop mechanics in gtkmm
> are a complete mystery to me, and the documentation is not very giving
> in this part.
>
> Okay, first question would be:
> Where comes this TargetEntry class into play? I don't get what I have to
> specify there. The examples in the documentation are rather odd and
> pretty meaningless to me (what are "STRING" and "text/plain" supposed to
> be?).
>
> Say I want to separate between dragging directories and files, would I
> then have to create two TargetEntries, one called "dir" and the other
> called "file", for example, or what?
>
> Furthermore, although I have set my treeview widget to be both
> destination and source for dnd events, it never accepts any "drops", at
> least not visually (the dragged entry always "flies back" to the source
> widget).
>
> How come?
>
> And what are the singal_drag_data_get and signal_drag_data_received
> events and when are they fired?
>
> So many questions :)

See:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch15.html

and for a bit more explanation:
http://www.gtk.org/tutorial/ch-dragangdrop.html

If you want to drag and drop between different tree views then you have to 
implement it yourself using the generic drag and drop methods inherited from 
Gtk::Widget (Gtk::TreeView::set_reorderable() only works when dragging and 
dropping within the same tree view).  If it is of any value to you (and it 
probably will not be), you can cast your eye over:

http://cvs.sourceforge.net/viewcvs.py/efax-gtk/efax-gtk/src/fax_list_manager.h?rev=1.24
http://cvs.sourceforge.net/viewcvs.py/efax-gtk/efax-gtk/src/fax_list_manager.cpp?rev=1.40

Chris.

-- 
Summer is y-cumen in, lhude sing, cuccu!
Groweth sed and bloweth med, springeth the wude nu.



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