Detect a potential drop on target dialog

When the ON DROP control block is defined, the ON DRAG_ENTER block will be executed when the mouse cursor enters the visual boundaries of the drop target dialog. Entering the target dialog is accepted by default if no ON DRAG_ENTER block is defined. However, when ON DROP is defined, you should also define ON DRAG_ENTER to deny the drop of objects with an unsupported MIME type that come from other applications.

The program can decide to deny or allow a specific drop operation with a call to ui.DragDrop.setOperation(); passing a NULL to the method will deny drop.

To check what MIME type is available in the drag & drop buffer, the program uses the ui.DragDrop.selectMimeType() method. This method takes the MIME type as a parameter and returns TRUE if the passed MIME type is used. You can call this method several times to check the availability of different MIME types.

You may also define the visual effect when flying over the target list with ui.DragDrop.setFeedback().

DEFINE dnd ui.DragDrop 
...
DISPLAY ARRAY arr TO sr.* ...
  ...
  ON DRAG_ENTER (dnd)
    IF dnd.selectMimeType("text/plain") THEN
      CALL dnd.setOperation("copy")
      CALL dnd.setFeedback("all")
    ELSE
      CALL dnd.setOperation(NULL)
    END IF
  ON DROP (dnd)
    ...
END DISPLAY

Once the mouse has entered the target area, subsequent mouse cursor moves can be detected with the ON DRAG_OVER trigger.