Skip to content

Item enableDragEvent

Bielen Pierre edited this page Jul 9, 2019 · 1 revision

Enable the drag and drop event for a specific item.

enableDragEvent(target)

  • target -> gadget id of target

Don't forget to activate the drop option of your gadget.

EnableGadgetDrop(#MY_GADGET,#PB_Drop_Text,#PB_Drag_Copy)
BindEvent(#PB_Event_GadgetDrop,@_eventDrop(),#MY_WINDOW,#MY_GADGET)

Example of procedure for manage it:

Procedure _eventDrop()
  Protected item.TREE::Item = Val(EventDropText())
  Protected x = WindowMouseX(#MAIN_FORM) - GadgetX(#CONTAINER_WORK)
  Protected y = WindowMouseY(#MAIN_FORM) - GadgetY(#CONTAINER_WORK)
  StartDrawing(CanvasOutput(#CANVAS_WORK))
  DrawText(x,y,item\getTitle())
  StopDrawing()
EndProcedure

Clone this wiki locally