A callback function to be called when data is dragged over a gadget or window that allows data to be dropped (see EnableGadgetDrop() / EnableWindowDrop()). The callback allows to modify the Drag & Drop process provided by PureBasic, for example by providing extra visual notification on the target gadget or window.


@DropCallback() A callback to be called during a drop operation.

The callback is called as the mouse enters, moves and leaves the target gadget or window and allows to provide additional feedback to the user, for example by highlighting the target item or area. Furthermore the callback can deny the currently intended action and this way specify more detailed where within a gadget or window the data can be dropped. The cursor should not be modified here, as the drag source is responsible for this.

The form of the callback is described below:
  Procedure DropCallback(TargetHandle, State, Format, Action, x, y)
    ProcedureReturn #True
The first parameter specifies the OS specific handle for the target gadget or window. On Windows this is a HWND value, on Linux a GtkWidget pointer and on MacOSX it is a ControlRef or WindowRef value. These are the same values as returned by GadgetID() or WindowID() for the target gadget or window.

'State' specifies the current state of the Drag & Drop operation and is one of the following values:
  #PB_Drag_Enter : The mouse entered the gadget or window
  #PB_Drag_Update: The mouse was moved inside the gadget or window, or the intended action changed
  #PB_Drag_Leave : The mouse left the gadget or window (Format, Action, x, y are 0 here)
  #PB_Drag_Finish: The Drag & Drop finished
'Format' specifies the data format and can be one of the following values, or an OS specific ID for a custom format (see DragOSFormats() for more information).
  #PB_Drop_Text   : Accept text on this gadget or window
  #PB_Drop_Image  : Accept images on this gadget or window
  #PB_Drop_Files  : Accept filenames on this gadget or window
  #PB_Drop_Private: Accept a "private" Drag & Drop on this gadget or window
'Action' specifies the action that would be taken if the user released the mouse at this point. It can be one of these values:
  #PB_Drag_None: The data will not be accepted if dropped here
  #PB_Drag_Copy: The data will be copied
  #PB_Drag_Move: The data will be moved
  #PB_Drag_Link: The data will be linked
By returning #True, the callback allows the action to take place at this point. By returning #False, the callback denies the action (the cursor will be changed to a "forbidden" cursor by the drag source). Especially if 'State' is #PB_Drag_Finish, returning #False will cause the whole Drag & Drop operation to fail.

Return value


See Also


Supported OS


<- SetDragCallback() - DragDrop Index