DragDrop for Datagrids

Bob Sneidar bobsneidar at iotecdigital.com
Tue Aug 6 10:59:49 EDT 2019


Hi all. 

Since being enlightened by Dar (I think it was) about setting the dragAction to "copy", I have entered into a new world of possibilities! One of them is drag and drop for datagrids. I'm sure that for those well versed in both datagrids and dragDrop, this will seem elementary, but for those who are not: 

on dragEnter
   -- this code will select datagrid records as you drag over them! 
   set the dragAction to "Copy"
   put the mouseControl into tControlID
   if tControlID is empty then exit dragEnter
   put the dgDataControl of tControlID into tDataControl
   
   -- trap for no control
   try
      put the dgIndex of tDataControl into tIndex
   catch tError
      exit dragEnter
   end try
   
   set the dgHilitedIndex of me to tIndex
end dragEnter

on dragDrop
   put the mouseControl into tControlID
   if tControlID is empty then exit dragDrop
   put the dgDataControl of tControlID into tDataControl
   
   -- trap for no control
   try
      put the dgIndex of tDataControl into tIndex
   catch tError
      exit dragDrop
   end try
   
   -- put your custom stuff here
   
   --
end dragDrop





More information about the use-livecode mailing list