Drag and Drop between Data Grids

Yves COPPE yvescoppe at skynet.be
Wed Dec 15 03:41:33 EST 2010


Le 14 déc. 2010 à 21:09, zryip theSlug a écrit :
> 
> Bob,
> 
> 1) In the datagrid source you need to have: the
> dgTrackDragReorder[tTheIndex] set to false
> 
> If set to true, the datagrid tracks the move inside it. If set to
> false you are allowed to move the data outside it.
> 
> Only this handler is required in the source datagrid:
> 
> on dragStart
>   local tTheIndex, tTheDragData, tTheDataControl
> 
>   put the dgDataControl of the target into tTheDataControl
> 
>   if (tTheDataControl is empty) then pass dragStart -- Prevent the
> move if no data control exists
> 
>   if (the dgHeader of the target is empty) then
>      put the dgIndex of the dgDataControl of the target into tTheIndex
>      set the dgDragImageIndex of me to tTheIndex
> 
>      ## Prepare the data to add in the datagrid 2
>      put the dgDataOfIndex[tTheIndex] of me into tTheDragData
>      combine tTheDragData using tab
>      set the dragData["private"] to tTheDragData
> 
>      set the dgTrackDragReorder[tTheIndex] of me to false --
> Important to move the data outside
>   end if
> end dragStart
> 
> 2) In the destination, you need two handlers:
> 
> on dragMove
>   set the dragaction to "copy"
> end dragMove
> 
> The dragaction will allow the datagrid to get the data you drop.
> 
> on dragDrop
>   local tTheNewData, tTheColOrder
> 
>   put "Col1" & cr & "Col2" into tTheColOrder
>   put the dragData["private"] into tTheNewData
>   send "AddLine tTheNewData, tTheColOrder" to me
> end dragDrop
> 
> The dragDrop handler will receive the data dropped if the dragaction is allowed.
> 




Hi

I have a problem with the script above
The text in the datagrid2 doesn't appear
When I add by drag 'n drop text from datagrid1 to datagrid2, I see the scroll bar of datagrid2 moving, so the text seems to be effectively added, but no text appears
When I place a breakpoint at end of the script of datagrid2 I see the variables with the good data.

What do I wrong ?

thanks.

Greetings.

Yves COPPE
yvescoppe at skynet.be




More information about the Use-livecode mailing list