Page 2 of 2

Re: copy items from a loaded grid to another grid or virtual grid

Posted: Wed Nov 11, 2020 10:53 pm
by AUGE_OHR
hi,

based on HMG_DaD_* Funcktion by EDK i wrote this Sample for GRID.

!Note : i have transfer C-Code to HB_FUNC.PRG
GRIDDUO.ZIP
(11.83 KiB) Downloaded 115 times

Re: copy items from a loaded grid to another grid or virtual grid

Posted: Thu Nov 12, 2020 12:16 am
by jairpinho
AUGE_OHR wrote: Wed Nov 11, 2020 10:53 pm hi,

based on HMG_DaD_* Funcktion by EDK i wrote this Sample for GRID.

!Note : i have transfer C-Code to HB_FUNC.PRG
GRIDDUO.ZIP

Jimmy, it was perfect for my application, this edk work is very useful, now I need to use this feature to select more items at the same time ie multi items copy with drag.

Edk and Jimmy, can you help me how to do

Re: copy items from a loaded grid to another grid or virtual grid

Posted: Thu Nov 12, 2020 1:06 am
by AUGE_OHR
hi

use Demo Source and change CELLNAVIGATION to MULTISELECT

Code: Select all

FUNCTION Grid_2_UpDate( cDragFName, cDragCName, nDragGridValue, cDropCName, cDropFName, nDropGridValue, lCopy, lAdd )
LOCAL aItem = GetProperty( cDragFName, cDragCName, "Value" )
LOCAL aDragItems, aClone, i := 1 , iMax := LEN(aItem)

   aClone := ACLONE(aItem)

   FOR i := 1 TO iMax
      // get select Item
      aDragItems := _GetItem( cDragCName, cDragFName, aItem[ i ] )
      // ADD Item to Target
      Domethod( cDropFName, cDropCName, "AddItem", aDragItems )
   NEXT

   aClone := ASORT(aClone,,,{|x, y| x > y })
   iMax := LEN(aClone)
   FOR i := 1 TO iMax
      // delete Item in Source
     Domethod( cDragFName, cDragCName, "DeleteItem", aClone[ i ] )
   NEXT

RETURN nil

Re: copy items from a loaded grid to another grid or virtual grid

Posted: Thu Nov 12, 2020 1:19 am
by jairpinho
AUGE_OHR wrote: Thu Nov 12, 2020 1:06 am hi

use Demo Source and change CELLNAVIGATION to MULTISELECT

Code: Select all

FUNCTION Grid_2_UpDate( cDragFName, cDragCName, nDragGridValue, cDropCName, cDropFName, nDropGridValue, lCopy, lAdd )
LOCAL aItem = GetProperty( cDragFName, cDragCName, "Value" )
LOCAL aDragItems, aClone, i := 1 , iMax := LEN(aItem)

   aClone := ACLONE(aItem)

   FOR i := 1 TO iMax
      // get select Item
      aDragItems := _GetItem( cDragCName, cDragFName, aItem[ i ] )
      // ADD Item to Target
      Domethod( cDropFName, cDropCName, "AddItem", aDragItems )
   NEXT

   aClone := ASORT(aClone,,,{|x, y| x > y })
   iMax := LEN(aClone)
   FOR i := 1 TO iMax
      // delete Item in Source
     Domethod( cDragFName, cDragCName, "DeleteItem", aClone[ i ] )
   NEXT

RETURN nil

Jimmy was perfect, now let's move forward, I have to clone the grid in a form main for a form2 of the modal type, no longer in the same form this is possible with drag