DataGrid DragDrop vs DragMove
zryip theSlug
zryip.theslug at gmail.com
Thu Jan 28 09:29:49 EST 2010
2010/1/28 RevList <RevList at createchsol.com>:
> I have been looking at Trevors stack from the RunRev 09 session that
> supports dragreorder and dragging and dropping data from a DataGroup to
> another.
> I want to drag and drop data from a data group to a text field, not
> another data group.
> The following works
>
> For the script of the DataGrid, I have this
>
> on dragStart
> put the dgDataControl of the target into theDataControl
>
> ## Watch out for dragging on the header
> if theDataControl is empty then pass dragStart
>
> ## Get Data Grid index of control that was clicked on
> put the dgIndex of the dgDataControl of the target into theIndex
>
> ## Tell Data Grid to set the dragImage to the row
> ## that theIndex is associated with
> set the dgDragImageIndex of me to theIndex
>
> ## Set the dragData["private"] so that drag operation
> ## begins
> put GetDataOfIndex(theIndex, "ID") into theID
> set the dragData["private"] to "MyData" & cr & theID
>
> ## I don't want to have to use this line, but I can't get by without
> it. See below
> set the dgTrackDragReorder[theIndex] of me to true
> end dragStart
>
> On the field script I have this
>
> On DragDrop
> if line 1 of the dragData["private"] is "MyData" then
> put line 2 of the dragData["private"] into me
> end if
> end DragDrop
>
> The trouble with the above is that I do not want to allow reordering of
> the data and the visual clue that the UI shows when this is enabled so I
> comment out the line.
> set the dgTrackDragReorder[theIndex] of me to true
> or set it to false.
>
> When I do that, the drag and drop no longer works.
>
> What does work, however is if I change the handler on the target field to
> DragMove instead of DragDrop.
> I don't want this however. I want drag drop and Not show the dragReorder
> visual effect.
> What am I doing wrong?
As far as I have understand, the "set the dgTrackDragReorder[theIndex]
of me to true" send internally to the tracker that a successful drop
occurs, so that's why nothing occurs if you remove this line.
I believe that you have to play with the "drop indicator" button
located in the data grid library. This button manage the visual
effect.
It seems that there is no property to change the drop indicator
behavior but if you have already duplicate the datagrid library you
could try in this way.
Trevor will be more helpful with this than me.
--
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc
More information about the use-livecode
mailing list