REVO27006 DragExampleB< 4c ULucida Grande UArial WLucida Grande ULucida Grande cREVGeneralbreakpointconditions breakpointsbreakpointstatescREVGeometryCachestackID1078 DragSource PKon preOpenCard set the style of this stack to palette end preOpenCard < cREVGeneralscripteditorvscroll0scripteditorselection74cREVGeometryCacheIDs1318629633275104513186298617751047131863080345710511318629062651104313186312192671060130306955022710031318697031129107713186309756951055cREVGeometrycachetotal8order$5 DragBehaviorEp  --The images to be drgged must have their bevior set to the script of this button. global gDestStack,gdestLocation on mouseDown --Create an image of the dragged object and set the dragImage to it put the long ID of me into tObj export snapshot from tObj to tVar as PNG if there is an img "DragImage" then set the width of img "DragImage" to the width of tObj set the height of img "DragImage" to the height of tObj set the visible of image "DragImage" to false put tVar into img "DragImage" end if -- The dragged object must have a custom property named uControlToBeCopied holding the ID of the control to be copied to the destination set the dragData["private"] to the uControlToBeCopied of me end mouseDown on dragStart --set the dragAction to "copy" put the clickH - the left of me into xOffset put the clickV - the top of me into yOffset set the dragImageOffset to xOffset,yOffset set the dragImage to the short id of img "DragImage" --The DragFrontScript tracks the mouse and what window it is over. Also ensures that -- the object can only be dragged onto a toplevel stack. insert script of btn "DragFrontScript" into front end dragStart on dragEnd --Get rid of the DragFrontScript remove script of btn "DragFrontScript" from front --Copy the control related to the dragged image to the stack. if gDestStack is not empty then put the dragData["private"] into tControlToBeCopied set the defaultStack to gDestStack copy control ID tControlToBeCopied of stack "DragExample" to stack gDestStack --Adjust the rectangle of the copied control so it it appears where it was dropped. put it into myNewControlID set the rectangle of myNewControlID to \ item 1 of gDestLocation - item 1 of the dragImageOffset & comma & \ item 2 of gDestLocation- item 2 of the dragImageOffset & comma & \ item 1 of gDestLocation - item 1 of the dragImageOffset + the width of myNewControlID & comma & \ item 2 of gDestLocation - item 2 of the dragImageOffset + the height of myNewControlID --You could adjust any properties of the new control here end if end dragEnd `R4 cREVGeneral revUniqueID 1303069550227scripteditorvscroll560scripteditorselection2138 Field)`XdDragExample cREVGeneralscripteditorvscroll0 revUniqueID 1318629062651scripteditorselection0   Label Field  cREVTable currentview(This is the control that will be copied: cREVGeneral revUniqueID 1318629633275 )This is the control that will be copied: FieldImage`~duControlToBeCopied1043DragExampleԉPNG  IHDRdBgAMA=-f9PLTEbbbnnnqqqʮڪ&FIDATHͷ AX* F^)X'5! Example of how to drag and drop between Stacks.

An image of the control is dragged. Its behavior is set to the "DragBehavior" button.

A custom property of the image named uControlToBeCopied is set to the short ID of the actual control.

 cREVGeneral revUniqueID 1318697031129 0Example of how to drag and drop between Stacks. VAn image of the control is dragged. Its behavior is set to the "DragBehavior" button. fA custom property of the image named uControlToBeCopied is set to the short ID of the actual control. revOnline | RunRev