Drag grid item to another grid
Moderator: Rathinagiri
- serge_girard
- Posts: 3173
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Drag grid item to another grid
Great Work Edward !
One question : would it also be possible to COPY to grid2 with CTRL-key (now it is always MOVEd)?
Serge
One question : would it also be possible to COPY to grid2 with CTRL-key (now it is always MOVEd)?
Serge
There's nothing you can do that can't be done...
Re: Drag grid item to another grid
What to do during the DragAndDrop operation depends on how you program this event.serge_girard wrote: ↑Fri Jan 04, 2019 3:14 pm Great Work Edward !
One question : would it also be possible to COPY to grid2 with CTRL-key (now it is always MOVEd)?
Serge
You have the following functions:
HMG_DaD_Drag_Window () -> returns the name of the form from which the drag started.
HMG_DaD_Drag_Control () -> returns the name of the control from which the drag started.
HMG_DaD_Drop_Window () -> returns the name of the form on which it was dropped.
HMG_DaD_Drop_Control () -> returns the name of the control on which it was dropped.
HMG_DaD_DragTreeValue () -> returns the value of the position of the tree from which the drag began.
HMG_DaD_DropTreeValue () -> returns the value of the tree position on which it was dropped.
HMG_Is_RButtonDaD () -> returns .T. if dragging was with the right mouse button.
Replace this function to copy from tree # 1 to tree # 2 with the right mouse button or with the ALT key.
Code: Select all
Function Drag_Tree2()
Local cDragFName := HMG_DaD_Drag_Window()
Local cDragCName := HMG_DaD_Drag_Control()
Local cDropFName := HMG_DaD_Drop_Window()
Local cDropCName := HMG_DaD_Drop_Control()
Local nDragTreeValue := HMG_DaD_DragTreeValue()
Local nDropTreeValue := HMG_DaD_DropTreeValue()
Local lIsDraggedWithRightButton := HMG_Is_RButtonDaD()
Local lCopy, aDragItems, nAddPos
IF HMG_Is_DaD()
HMG_Release_DaD()
DO CASE
CASE cDropCName == 'Tree_2'
//Move nodes/items
lCopy := HMG_VirtualKeyIsPressed (VK_LCONTROL) .OR. HMG_VirtualKeyIsPressed (VK_RCONTROL) .OR. HMG_VirtualKeyIsPressed (VK_ALT) .OR. lIsDraggedWithRightButton
aDragItems := _GetTreeItemStru( cDragFName, cDragCName, nDragTreeValue )
IF !EMPTY ( aDragItems )
IF !lCopy .AND. nDropTreeValue < nDragTreeValue //dropped above the drag
DoMethod (cDragFName, cDragCName, "DeleteItem", nDragTreeValue)
ENDIF
nAddPos := nDropTreeValue
AEVAL ( aDragItems, { |x| ( DoMethod (cDropFName, cDropCName, "AddItem", x[2] , nAddPos + x[3] ), IF( x[3]=0 /* 1-st item added as last nodes item */, nAddPos := nAddPos + LEN( _GetTreeItemStru( cDropFName, cDropCName, nDropTreeValue ) ) - 1 - x [1] , Nil) ) } )
IF !lCopy .AND. nDropTreeValue > nDragTreeValue //dropped below the drag
DoMethod (cDragFName, cDragCName, "DeleteItem", nDragTreeValue)
ENDIF
DoMethod (cDropFName, cDropCName, "Redraw")
DoMethod (cDragFName, cDragCName, "Redraw")
ENDIF
ENDCASE
ENDIF
RETURN
- serge_girard
- Posts: 3173
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
- mustafa
- Posts: 1162
- Joined: Fri Mar 20, 2009 11:38 am
- DBs Used: DBF
- Location: Alicante - Spain
- Contact:
Re: Drag grid item to another grid
Edk
Very interesting
Congratulations
Mustafa
Very interesting
Congratulations
Mustafa
Re: Drag grid item to another grid
Great work!
It would be excellent to have colorized new parent element in the tree while dragging child.
Thank you very much, Edward!
It would be excellent to have colorized new parent element in the tree while dragging child.
Thank you very much, Edward!
Re: Drag grid item to another grid
Thanks Edward for such a useful enhancement !!
Regards,
Anand
Regards,
Anand
Re: Drag grid item to another grid
Thank you Edward!
Best Regards,
Nikos.
os: Windows Server 2019 - 64
Nikos.
os: Windows Server 2019 - 64
Re: Drag grid item to another grid
Jesteś wielki!
Król Edward na 3 Króli!
Ps. Jakim programem robisz te animowane gify?
Król Edward na 3 Króli!
Ps. Jakim programem robisz te animowane gify?
Re: Drag grid item to another grid
Dzięki, gify zrobilem oCam'em