4D v13.4DRAG AND DROP PROPERTIES |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
DRAG AND DROP PROPERTIES
DRAG AND DROP PROPERTIES
Compatibility note: Since version 11 of 4D, it is recommended to manage drag and drop operations, especially interprocess ones, using the On Begin Drag Over event and the commands of the Pasteboard theme. The DRAG AND DROP PROPERTIES command enables you to obtain information about the source object when an On Drag Over or On Drop event occurs for a “complex” object (array, list box or hierarchical list). Typically, you use DRAG AND DROP PROPERTIES from within the object method of the object (or from one of the subroutines it calls) for which the On Drag Over or On Drop event occurs (the destination object). 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. After the call:
If you call DRAG AND DROP PROPERTIES when there is no drag and drop event, srcObject returns a NIL pointer, srcElement returns -1 and srcProcess returns 0. Tip: 4D automatically handles the graphical aspect of a drag and drop. You must then respond to the event in the appropriate way. In the following examples, the response is to copy the data that has been dragged. Alternatively, you can implement sophisticated user interfaces where, for example, dragging and dropping an array element from a floating window will fill in the destination window (the window where the destination object is located) with structured data (i.e., several fields coming from a record uniquely identified by the source array element). You use DRAG AND DROP PROPERTIES during an On Drag Over event in order to decide whether the destination object accepts the drag and drop operation, depending on the type and/or the nature of the source object (or any other reason). If you accept the drag and drop, the object method must return $0:=0. If you do not accept the drag and drop, the object method must return $0:=-1. Accepting or refusing the drag and drop is reflected on the screen—the object is or is not highlighted as the potential destination of the drag-and-drop operation. In several of your database forms, there are scrollable areas in which you want to manually reorder the elements by simple drag and drop from one part of the scrollable area into another within it. Rather than writing specific code for each case, you may implement a generic project method that will handle any one of these scrollable areas. You could write something like: ` Handle self array drag and drop project method Once you have implemented this project method, you can use it in the following way: ` anArray Scrollable Area Object Method In several of your database forms, you have text enterable areas in which you want to drag and drop data from various sources. Rather than writing specific code for each case, you may implement a generic project method that will handle any one of these text enterable areas. You could write something like: ` Handle dropping to text area project method Once you have implemented this project method, you can use it in the following way: ` [anyTable]aTextField Object Method We want to fill a text area (for example, a label) with data dragged from a list box. Here is the label1 object method: Case of It then becomes possible to carry out the following action: |
PROPERTIES
Product: 4D
INDEX HISTORY
Modified: 4D 2004.2 SEE ALSO
Drag and Drop |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||