DataGrid DragDrop vs DragMove

RevList RevList at CreaTECHSol.com
Wed Jan 27 19:59:33 EST 2010


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?

******************************************
Stewart Lynch
CreaTECH Solutions
******************************************

--------------------------------------------------------------------------------------------------------------------
This message and any attachments are intended only for the use of the
individual to whom they are addressed and it may contain information that
is privileged or confidential. If you have received this communication by
mistake, please notify us immediately.
--------------------------------------------------------------------------------------------------------------------




More information about the use-livecode mailing list