Page 1 of 1
DataGrid/Drag and Drop
Posted: Mon Sep 28, 2009 11:51 pm
by phaworth
I have not yet tried programming any drag and drop operations so hoping to get some guidance before starting down that path.
Specifically, is it possible to drag and drop a line in a datagrid onto a line in a different datagrid?
I'm hoping to implement something like the way the Mac Address Book lets you move a person into a group by simply dragging that person's name over the group name.
Thanks,
Pete
Posted: Tue Sep 29, 2009 8:13 pm
by trevordevore
Yes you can. The sample application from my presentation at RunRevLive has an example of this.
http://tr.im/data_grid
Look at the download and manual under the "Presenting Data with the Data Grid" section on the above page for example code and instructions.
Posted: Tue Sep 29, 2009 9:08 pm
by phaworth
Thanks Trevor, downloaded the sample app and the manual and am looking through it now.
Pete
Posted: Tue Sep 29, 2009 11:12 pm
by phaworth
Ok, I have all this working just like I want it to except for one thing I don't understand and one question.
The dragStart code contains a reference the dgDragImageIndex property but I can't find any reference to that property in the Datagrid Manual.
I'm concerned that there isn't any visual feedback to the user while the drag/drop operation is going on until the mouse is over the destination. I was hoping that there would be a way of showing things more visually. If you're familiar with the Mac Address Book, when you start to drag a name in the list, a small icon appears that follows the mouse and when the mouse is over an entry in the Group list, the image changes slightly to include a plus sign to indicate that the person will be added to that group.
Doesn't have to necessarily be as sophisticated as that, just some way of indicating that something is being dragged before the mouse lands on the destination.
Thanks,
Pete
Posted: Tue Sep 29, 2009 11:32 pm
by trevordevore
There is an updated version of the Data Grid library on that same page I sent you to. There should be instructions for installing it as well. After installing it the dgDragImageIndex will magically set the dragImage to a snapshot of the row you are dragging. This should provide some good visual feedback for you.
Posted: Tue Sep 29, 2009 11:40 pm
by phaworth
Thanks Trevor, that works perfectly.
Is there some doc somewgere on what else is new in this version of the library?
Thanks,
Pete
Posted: Wed Sep 30, 2009 4:27 am
by trevordevore
Not yet. The new library isn't really an official release and I haven't gotten around to documenting the new features yet or picking out the relevant entries for the change log.