Re: FW: [gtkmm] drag and drop with multiple targets



Erik,

Thanks for that information - that will help clear up Gtk::TargetEntry () questions I had.

Before I get to that stage though, I'm having trouble setting up my GUI so I can do what I
want.

I need to create a dialog (eventually in a tabbed container and scrollable) containing a
number (eventually large) of "icons" that act as both a source and target for drag / drop
operations.

For my test, I simply have a handful of buttons in a window and make calls like (some params
removed for clarity):

std::list < Gtk::TargetEntry > dndList;
dndList.push_back ( Gtk::TargetEntry ( "WIDGET1", 101, 1 ) );
dndList.push_back ( Gtk::TargetEntry ( "WIDGET2", 102, 2 ) );
dndList.push_back ( Gtk::TargetEntry ( "WIDGET3", 103, 3 ) );

testButton1.drag_source_set ( dndList, ..., ... );
testButton1.signal_drag_data_get().connect ( ... );
testButton1.drag_dest_set ( dndList, ..., ... );
testButton1.signal_drag_data_received().connect ( ... );

testButton2.drag_source_set ( dndList, ..., ... );
testButton2.signal_drag_data_get().connect ( ... );
testButton2.drag_dest_set ( dndList, ..., ... );
testButton2.signal_drag_data_received().connect ( ... );

and so on.

I'd figured that I'd add an entry in the std::list<> for each widget and there would be some
way in the methods called when drags/drops happen that would tell me which one was dragged
where.

The best I've done so far is in the method that gets called when drag data is received, I
call:

Gtk::Widget* sourceWidget = Gtk::Widget::drag_get_source_widget ( contextIn );

and then get to the rest of the widget information - not really a good solution.

I think I'm missing something. I don't really want a separate std::list <> for each widget
since there will eventually be a large number of them.

Any advice or direction much appreciated.

Callum.


--- "Ohrnberger, Erik" <erik_ohrnberger dme net> wrote:
> Callum,
> 	I was pretty much wrapped up in much the same issue.  With
> everyone's help on this list, especially Murray's, I was able to put this
> email summary together.  Perhaps you'll find it as useful as I did in
> resolving my drag and drop questions.
> 
> 	Cheers,
> 		Erik.
> 
> Behalf Of Ohrnberger, Erik
> > Paul,
> > 	I've read the paper by Owen Taylor about drag and drop 
> > in GTK+ and GNOME, and I've followed that to the indicated 
> > resources IANA MIME type registry 
> > (ftp://ftp.isi.edu/in-notes/iana/assignments/media-type).
> > 
> > 	This appears to me as a pretty significant issue when 
> > it comes to application design and interoperability.  I'm 
> > rather surprised that at least references to this discussion 
> > and the MIME type registry is not included in the tutorial 
> > about drag and drop.  It really should be in there (IMHO).
> > 
> > 	Do you, or the gtkmm tutorial authors, think that it 
> > would a significant loss of information should the Taylor 
> > paper not become available in the future?  If so, is there a 
> > means that this could be incorporated into the tutorial?
> 
> I'm reading this thread now. I wrote the Drag and Drop stuff in the
> documentation. It's the first time that I have heard about MIME types in
> relation to Drag and Drop, but maybe this solves the mystery of what the
> hell those target names are. I'll try to investigate and update the book.
> Obviously this stuff should be in there if it's appropriate.
> 
> > 	Anyway, with the Taylor paper, the IANA registry, and 
> > the information in the tutorial, I much better understand 
> > what's going on, why it's significant, and how to implement 
> > it better.  It would seem to me that including this 
> > information, or at least references, and / or links, to this 
> > information, really should be part of the tutorial so that 
> > the readers of the tutorial understand the wider implications 
> > of the design and implementation decisions that they are 
> > making.  It certainly opened my eyes to it all.
> > 
> > 	In conclusion, I guess this email boils down to an 
> > enhancement request for the tutorial documentation.
> > 
> > 	Cheers and best wishes,
> > 		Erik.
> 
> Murray Cumming
> www.murrayc.com
> murrayc usa net
> 
> > 
> > > -----Original Message-----
> > > From: Ohrnberger, Erik
> > > Sent: Monday, November 17, 2003 11:40 AM
> > > To: Ohrnberger, Erik
> > > Subject: RE: [gtkmm] Drag And Drop Context data
> > > 
> > > 
> > > Paul,
> > > 	Very much thank you.  I found it.  I'll be reading that.
> > > 
> > > 	Thanks,
> > > 		Erik.
> > > 
> > > > -----Original Message-----
> > > > From: Paul Davis [mailto:paul linuxaudiosystems com]
> > > > Sent: Saturday, November 15, 2003 1:47 PM
> > > > To: Erik echohome org
> > > > Cc: gtkmm-list gnome org
> > > > Subject: Re: [gtkmm] Drag And Drop Context data 
> > > > 
> > > > 
> > > > >Paul,
> > > > >	I check with Google, as well as http://www.gtkmm.org,
> > > > and other than
> > > > >what I've already read, I've not found any additional 
> > information.
> > > > 
> > > > google: MIME drag drop target
> > > > 
> > > > the most useful link is about 2/3 down on the first page,
> > > > points to a PS file at redhat.com. i can't cut-n-paste it 
> > > > very easily ...
> > > > 
> > > > --p
> > > > 
> > > 
> > _______________________________________________
> > gtkmm-list mailing list
> > gtkmm-list gnome org http://mail.gnome.org/mailman/listinfo/gtkmm-list
> > 
> 
> > -----Original Message-----
> > From: Erik Ch. Ohrnberger [mailto:Erik mail echohome org]
> > Sent: Wednesday, February 04, 2004 6:29 PM
> > To: Ohrnberger, Erik
> > Subject: [gtkmm] drag and drop with multiple targets
> > 
> > 
> > gtkmm-list gnome org
> > Callum Prentice[lists callum com]
> > 
> > i recently posted this to the regular gtk list but didn't receive any
> > feedback - i didn't realize this list existed until today so 
> > am re-posting
> > here.
> > 
> > part of my application involves being able to shuffle around 
> > small (say:
> > 64x64) images using drag and drop and i'm trying to implement 
> > this using the
> > mechanism built into gtk+.
> > 
> > as far as i can tell, you need to have a separate container of
> > Gtk::TargetEntry's for each source/target - you can't tell 
> > what the source
> > was otherwise - given that i could have lots (100's perhaps) 
> > of these, is
> > there a better way ?
> > 
> > i'm using regular buttons (eventually with the images 
> > embedded) for each
> > element since it looks like that is the only option for a 
> > drag/drop source -
> > is there a better widget to use ? labels didn't seem to work.
> > 
> > any comments appreciated ? 
> > _______________________________________________
> > gtkmm-list mailing list
> > gtkmm-list gnome org http://mail.gnome.org/mailman/listinfo/gtkmm-list
> > 
> > 




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