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

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

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

Post 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 114 times
have fun
Jimmy
User avatar
jairpinho
Posts: 420
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Contact:

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

Post 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
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br
User avatar
AUGE_OHR
Posts: 2093
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

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

Post 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
have fun
Jimmy
User avatar
jairpinho
Posts: 420
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Contact:

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

Post 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
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br
Post Reply