What does the DragData contain?

zryip theSlug zryip.theslug at gmail.com
Thu Jan 13 16:35:53 EST 2011


On Tue, Jan 11, 2011 at 12:57 AM, Bob Sneidar <bobs at twft.com> wrote:

Hi Bob,

> Well I know that I can put something into the dragData["private"] which either makes this a custom behavior, or else an array. I vote for the former. But is there any other "elements" that the dragData contains that I can use? For instance, the source object I drag from?
>
> I have 3 datagrids. I want to drag from grid1 into grid2 and have the value drop in the first column of grid2. I want to drag from grid3 into grid2 and have the value drop into the 3rd column of grid2. To do that properly, I need the dragDrop handler in grid2 to know where I am dragging from.
>
> Now I could simply make the dragData["private"] a comma delimited list and then parse it in grid2, but I was thinking there might be a cleaner way for grid2 to know what the source is. I would think the engine would know. I tried to create my own custom key, but of course I cannot do that. The structure seems to be read only.

The dragSource contains information about the source datagrid. We have
4 levels of object to resolve to have the name of the datagrid.

1. The name of the target field you started dropping
2. The name of the col group where the field is (it is the name of the column)
3. The dgList object
4. The mask

So we could have something like this:

put the dragSource into tTheSource
put the short name of the owner of the owner of the owner of the owner
of tTheSource

That is not totally readable in time, I think. You will prefer to have
the name of the source datagrid somewhere in the dragData.


It was an interesting exercice, so I tested replacing the content of a
column in a grid by dropping a line of another datagrid.
The idea was to use the dgTrackDragReorder property in the destination
datagrid for scrolling the dg during the dragMove, and to replace a
value in a column by using the DragReorderDrop event of the datagrid
messages.
By testing the name of the datagrid source, the DragReorderDrop is
capable to behave normally when one want to reorder the lines in the
dg.

The resulting experiment is available here:
http://www.aslugontheroad.co.cc/index.php?option=com_phocadownload&view=category&download=19:experiment-19-drag-drop-in-dg-replacing-a-value-in-a-column&id=7:data-grid&Itemid=63


Best regards,
-- 
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc




More information about the use-livecode mailing list