DataGrid/Drag and Drop

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

DataGrid/Drag and Drop

Post by phaworth » Mon Sep 28, 2009 11:51 pm

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

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Post by trevordevore » Tue Sep 29, 2009 8:13 pm

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.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Post by phaworth » Tue Sep 29, 2009 9:08 pm

Thanks Trevor, downloaded the sample app and the manual and am looking through it now.
Pete

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Post by phaworth » Tue Sep 29, 2009 11:12 pm

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

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Post by trevordevore » Tue Sep 29, 2009 11:32 pm

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.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Post by phaworth » Tue Sep 29, 2009 11:40 pm

Thanks Trevor, that works perfectly.

Is there some doc somewgere on what else is new in this version of the library?

Thanks,
Pete

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Post by trevordevore » Wed Sep 30, 2009 4:27 am

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.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

Post Reply