| 4D v13.4Drop position | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|  | 
    4D v13.4
 Drop position 
         | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Drop position {( columnNumber | pictPosY )} -> Function result | ||||||||
| Parameter | Type | Description | ||||||
| columnNumber | pictPosY | Longint |   | List box column number (-1 if the drop occurs beyond the last column) or Position of Y coordinate in picture | |||||
| Function result | Longint |   | • Number (array/list box) or • Position (hierarchical list) or • Position in string (text/combo box) of destination item or • -1 if drop occurred beyond the last array element or list item • Position of X coordinate in picture | |||||
The Drop position command can be used to find out the location, in a “complex” destination object, where an object has been (dragged and) dropped.
Typically, you will use Drop position when handling a drag and drop event that occurred over an array, a list box, a hierarchical list or a text or picture field.
If you call Drop position when handling an event that is not a drag-and-drop event and that occurred over an array a list box, a combo box, a hierarchical list, a text or a picture, the command returns -1.
Important: A form object accepts dropped data if its Droppable property has been selected. Also, its object method must be activated for On Drag Over and/or On Drop, in order to process these events.
See the examples for the DRAG AND DROP PROPERTIES command.
In the following example, a list of amounts paid must be broken down per month and per person. This is carried out by drag and drop from a scrollable area:

The list box object method contains the following code:
 Case of
    :(Form event=On Drag Over)
       DRAG AND DROP PROPERTIES($source;$arrayrow;$processnum)
       If($source=Get pointer("SA1")) `If the drop does come from the scrollable area
          $0:=0
       Else
          $0:=-1 `The drop is refused
       End if
    :(Form event=On Drop)
       DRAG AND DROP PROPERTIES($source;$arrayrow;$processnum)
       $rownum:=Drop position($colnum)
       If($colnum=1)
          BEEP
       Else
          Case of `Adding of dropped values
             :($colnum=2)
                John{$rownum}:=John{$rownum}+SA1{$arrayrow}
             :($colnum=3)
                Mark{$rownum}:=Mark{$rownum}+SA1{$arrayrow}
             :($colnum=4)
                Peter{$rownum}:=Peter{$rownum}+SA1{$arrayrow}
          End case
          DELETE FROM ARRAY(SA1;$arrayrow) `Updating of area
       End if
 End case
	Product:  4D
	Theme:  Drag and Drop
	Number:  
        608
        
        
        
	
	Modified:  4D v11 SQL  
	Modified:  4D v12
Drag and Drop
DRAG AND DROP PROPERTIES