Code: Select all
Enumeration
#Window
#Frame
#Container
#ContainerString
#Button
EndEnumeration
If OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 400, 90, "Drag'n'Drop Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
FrameGadget(#Frame, 0, 0, 400, 90, "", #PB_Frame_Container) ; 1) Comment this and drag'n'drop works, frame isn't visible
ContainerGadget(#Container, 0, 0, 400, 60)
StringGadget(#ContainerString, 10, 10, 380, 40, "Drag a file (or folder) to display its path")
EnableGadgetDrop(#ContainerString, #PB_Drop_Files, #PB_Drag_Move)
CloseGadgetList()
CloseGadgetList()
ButtonGadget(#Button, 10, 60, 380, 20, "Button")
; EnableGadgetDrop(#Button, #PB_Drop_Files, #PB_Drag_Move) ; 2) Uncomment this while "1)" is still uncommented, frame gets visible + position is shifted a little & drag'n'drop works now
Repeat
Select WaitWindowEvent()
Case #PB_Event_GadgetDrop
SetGadgetText(EventGadget(), EventDropFiles())
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
EndIf