EnableGadgetDrop()

Syntax

EnableGadgetDrop(#Gadget, Format, Actions [, PrivateType])
Description
Enables a gadget to be a target for Drag & Drop operations of a specific format. When the user drags data of this format over the gadget, the cursor will indicate that the data can be dropped there.

Parameters

#Gadget The PureBasic gadget number for the gadget in question.
Format The data format, which 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
  #PB_Drop_Image  : Accept images on this gadget
  #PB_Drop_Files  : Accept filenames on this gadget
  #PB_Drop_Private: Accept a "private" Drag & Drop on this gadget
Actions A combination of the Drag & Drop actions that should be allowed for the data. The user can decide which of these actions to take by pressing modifier keys like Ctrl or Shift. The actions that can really be taken also depend on the actions allowed by the drag source. Possible actions are: (they can be combined with '|')
  #PB_Drag_None: The data format will not be accepted on the gadget
  #PB_Drag_Copy: The data can be copied
  #PB_Drag_Move: The data can be moved
  #PB_Drag_Link: The data can be linked
PrivateType (optional) The type of private Drag & Drop to accept if 'Format' is #PB_Drop_Private. See DragPrivate() for more information. This parameter is ignored for other formats.

Return value

None.

Remarks

Multiple formats can be allowed on the same gadget. If the drag source provides multiple formats that match the list of accepted formats, the one that was added last will be accepted. So the preferred format in which to receive data should be enabled last.

If data was dropped on the gadget, the program will receive a #PB_Event_GadgetDrop event. EventGadget() will indicate the target gadget and the Event functions of this library can be used to get the dropped data.

See Also

EnableWindowDrop(), EventDropType(), EventDropAction(), SetDropCallback()

Supported OS

All

<- DragText() - DragDrop Index - EnableWindowDrop() ->