Page 1 of 1

drag and drop with data grid problems

Posted: Tue Nov 22, 2011 11:24 pm
by eshultz
I can't get a drag and drop to either a table or record version of the datagrid if the data grid already has some data in it. LiveCode hangs and my only option is to force quit it. I know the example below doesn't drop any new data; it's intended to show that virtually anything that updates the dgData of the data grid, even its current contents, will cause it to hang, and that it's not due to the material begging dropped. Using version 5.0:

the handlers are trivial:
on dragEnter
set the acceptDrop to true
end dragEnter

on dragDrop
put the dgData of group "DataGrid 6" into dgArrayA
set the dgData of group "DataGrid 6" to dgArrayA-- hangs on this statement or next
end dragDrop

it will hang either when stepping through or post execution of the dragDrop handler.
Any help for a newbie appreciated.

Ed

Re: drag and drop with data grid problems

Posted: Wed Nov 23, 2011 12:12 am
by Zryip TheSlug
Hi Ed,

Have a look to the "Experiment 015 - Drag & Drop in DG v 1.0.1" stack, by following this link:
http://www.aslugontheroad.com/index.php ... &Itemid=63


This example should maybe help you in your drag & drop implementation.



Best Regards,

Re: drag and drop with data grid problems

Posted: Wed Nov 23, 2011 4:22 am
by eshultz
Excellent! I had finally managed to do what I thought a total kludge: sending a mouse up to a hidden button to do the work, which did not trigger the fatal lockup. Your solution is clearly much more elegant, which leads me to: how did you deduce that calling a command was necessary? Am I missing some key documentation or did you work things out by trial and error as I did?

Many thanks again
Ed

Re: drag and drop with data grid problems

Posted: Wed Nov 23, 2011 11:07 am
by kevin11
I don't know if this helps, but I have found that if you throw data at a datagrid from within a datagrid handler, for example, set the dgData of group "DataGrid 6" to dgArrayA from inside the handler, then it either does nothing at all, or hangs up. If you arrange to throw the data at the grid from outside the handler, it then works. Anyway, that's what I've found, so I get round it by passing a mouseup, say, out of the handler to be captured elsewhere and then set the dgData of group "DataGrid 6" to dgArrayA

Re: drag and drop with data grid problems

Posted: Wed Nov 23, 2011 4:19 pm
by eshultz
Sounds like it was through trial and error. Sigh, but at least it works! I note that you use quite a few properties of the dgGrid that I am unaware of:dgDataControl, dgDragImageIndex, dgDataOfIndex, etc. How did you discover these and their definitions? Is there a package to be purchased that has the documentation?

Ed

Re: drag and drop with data grid problems

Posted: Thu Nov 24, 2011 12:07 am
by Zryip TheSlug
eshultz wrote:Sounds like it was through trial and error. Sigh, but at least it works! I note that you use quite a few properties of the dgGrid that I am unaware of:dgDataControl, dgDragImageIndex, dgDataOfIndex, etc. How did you discover these and their definitions? Is there a package to be purchased that has the documentation?
Hi Ed,

First of all, by reading the datagrid lessons.

1. The datagrid API:
http://lessons.runrev.com/s/lessons/m/d ... a-Grid-API

2. And the datagrid lessons:
http://lessons.runrev.com/s/lessons/m/datagrid

The datagrid lessons are totally free and help a lot for learning about datagrids.

You have also an introduction about datagrid available on revOnline or by following this link:
http://www.aslugontheroad.com/index.php ... &Itemid=63


Then I studied how the datagrid library is built.

At last, I learned a lot about datagrids by creating the Data Grid Helper Plugin which uses a datagrid table of 2 visible columns for displaying properties:
Image


Best Regards,