the dragdestination wierdness

Bob Sneidar bobs at twft.com
Fri Jan 8 20:43:51 EST 2010


Here's an update. Seems I was overcomplicating things by trying to read the API docs and not knowing what I was doing. This works:

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 dgDataControl of the target into theTargetLongID
   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
   set the dragData["private"] to the short name of theDataControl
    
   set the dgTrackDragReorder[theIndex] of me to true
end dragStart
   
on DragDrop
   put dragData["private"] into theDropSource
   put the short name of the dgDataControl of the target into theDropTarget
   put theDropSource & return & theDropTarget 
end DragDrop  

This returns: 
SecFields 0001
SecFields 0002

As expected, or more specifically, the source of the drag and the destination of the drop. I didn't know "the dgDataControl of the target" changed when I executed a drag and drop. I thought it only referred to the source of the drag. 

Bob


On Jan 8, 2010, at 5:12 PM, Trevor DeVore wrote:

> On Jan 8, 2010, at 7:49 PM, Bob Sneidar wrote:
> 
>> Apparently what is happening is that when I drag within a datagrid to another row in the same datagrid, the DragDestination returns the name of the TEMPLATE field, and NOT the name of the INSTANCE field, that is the field named after the column, and the index number.
> 
> _ColumnData_ is the name of the field. You want to access the custom props of the cell. Try checking the dgColumn of the dragDestination.
> 
> -- 
> Trevor DeVore
> Blue Mango Learning Systems
> ScreenSteps: http://www.screensteps.com
> Releasable Revolution Resources for Developers: http://revolution.bluemangolearning.com
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list