Products Downloads


French version


 

Note: We strongly recommend using this new version of Drag and Drop instead of the old version used in the Tree View, Tree List, List and Image graphical objects.

 

The "Drag and Drop" feature uses the mouse to transfer data between two graphical components. More specifically, the user clicks on the source component and holds down the button while moving the mouse pointer over the destination component, then releases the button. The operation can be cancelled by pressing the Escape key.

The source and destination components can be in different applications or windows.

 

Concerning the Visual Adelia program, certain events, properties and methods must be used, as illustrated in the following scenario:

  1. When the user left- or right-clicks on a source object, the source receives the event DD_BeginDrag. The DD_KEYBOARD_STATE and DD_MOUSE_STATE properties identify which buttons and keys are depressed.

  2. With this event, the developer uses the DD_WRITE_DATA and DD_EXECUTE_DRAG methods to specify the data to be transferred and initiate the drag and drop mechanism. This data can be either moved or copied to the destination object. Note that any instructions after DD_EXECUTE_DRAG will not be executed until the drag and drop action is complete.

  3. When the user moves the mouse while holding down the button, the mouse pointer may move over an object that could be a destination. Such objects must have the DD_DROP_ALLOWED set to *TRUE. If this is not the case, or if the object under the mouse pointer does not support drag and drop, the system replaces the mouse pointer with a 'no parking' symbol .
    The following events are triggered in the destination object:

    • When the mouse pointer enters the area covered by the destination object, the object receives a DD_EnterDrag event. With this event, the developer can use the destination object's DD_ACTION_DROP property to specify what the result of the operation would be if the user released the mouse button at that point. The developer can also use the DD_KEYBOARD_STATE and DD_MOUSE_STATE properties or the DD_DATA_AVAILABLE method, to determine whether the destination object should accept a copy, or the movement, of the data, or instead reject it. The developer must also consider the DD_ALLOWED_ACTIONS property, which contains the actions permitted by the source object (parameter of the DD_EXECUTE_DRAG method). Programming this event is optional.
    • While the mouse pointer is within the area covered by the destination object, the latter receives a steady stream of DD_DragOver events. As before, the developer can use the destination object's DD_ACTION_DROP property to specify what the result of the operation would be if the user released the mouse button at that point. The developer can also use the DD_KEYBOARD_STATE and DD_MOUSE_STATE properties or the DD_DATA_AVAILABLE method, to determine whether the destination object should accept a copy, or the movement, of the data, or instead reject it. The developer must also consider the DD_ALLOWED_ACTIONS property, which contains the actions permitted by the source object (parameter of the DD_EXECUTE_DRAG method).

    • When the mouse pointer exits the area covered by the destination object, the object receives a DD_ExitDrag event. Programming this event is optional.

    • When the user releases the mouse button while the mouse pointer is within the area covered by a destination object, the object receives a DD_Drop event. The DD_ACTION_DROP property contains the action specified when the DD_DragOver event (i.e. _DD_ACTION_COPY or _DD_ACTION_MOVE) occurs. The developer can use the DD_READ_DATA method to retrieve the transferred data.

  4. In the DD_BeginDrag event, the DD_EXECUTE_DRAG method terminates and the developer must then delete the transferred data from the source object if the action was a 'move' action.

 

Important note: The new version of the Drag and Drop is not available in Java generation.

 

Click here to see an example of a drag and drop operation

 

 

 

 

 

↑ Top of page

  • Aucune étiquette