SetDragCallback()

Syntax

SetDragCallback(@DragCallback())
Description
A callback function to be called during a Drag & Drop operation initiated from this application. The callback allows to modify the Drag & Drop process provided by PureBasic, for example by providing a custom cursor through the API of the Operating system.

Parameters

@DragCallback() The address of a function to call during a drag operation. The form and purpose of the callback is dependant on the OS. It must take the following form:

Windows:
  Procedure DragCallback(Action)
  
    ProcedureReturn #True
  EndProcedure
The callback is called during the Drag & Drop operation. 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
The callback can provide a custom cursor or drag image. If it does so, it should return #False. Returning #True will cause the default cursor to be used.
Linux:
  Procedure DragCallback(*Context.GdkDragContext, isStart)
  
  EndProcedure
The callback is only called at the start and the end of a Drag & Drop operation. The '*Context' parameter specifies the gdk drag context of this operation, 'isStart' specifies whether this is the start or the end of the operation. The return-value of the callback is ignored.

Gtk functions like gtk_drag_set_icon_pixbuf_() can be used in the callback to set a different drag image for the operation.
MacOSX:
  Procedure DragCallback(DragReference, isStart)
  
  EndProcedure
The callback is only called at the start and the end of a Drag & Drop operation. The 'DragReference' parameter specifies the Carbon drag context of this operation in form of a 'DragRef' value, 'isStart' specifies whether this is the start or the end of the operation. The return-value of the callback is ignored.

All functions of the Carbon Drag Manager can be used to influence the drag operation before it starts (adding more flavors/items for example) and to get more information about the operation after it completed.

Return value

None.

See Also

SetDropCallback()

Supported OS

All

<- EventDropY() - DragDrop Index - SetDropCallback() ->