This is currently not quite true.This kind of gadget is decorative only.
Calling the FrameGadget() function can defeat Drag and Drop, depending on the exact place in the source code where it is used (tested on Windows). This is demonstrated by the following examples:
- In the first example, FrameGadget() comes before StringGadget()
--> Drag and Drop does not work with StringGadget().
//edit: As BarryG pointed out, this example would work without the flag #PB_Frame_Flat. - In the second example, FrameGadget() comes after StringGadget()
--> Drag and Drop does work with StringGadget().
Code: Select all
; PB 5.72
EnableExplicit
; Windows
#WinMain = 0
; Gadgets
Enumeration
#Frame1
#Text1
#String1
#Frame2
#Text2
#String2
#BtnQuit
EndEnumeration
#WinWidth = 400
#WinHeight = 280
#Frame1X = 10
#Frame1Y = 20
#Frame2X = 10
#Frame2Y = 120
Define event.i, dropped$
If OpenWindow(#WinMain, 0,0, #WinWidth,#WinHeight, "Drag and Drop files",
#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget) = 0
MessageRequester("Fatal error",
"Can't open main window.",
#PB_MessageRequester_Error)
End
EndIf
FrameGadget(#Frame1, #Frame1X, #Frame1Y, #WinWidth-20,75, "", #PB_Frame_Flat)
TextGadget(#Text1, #Frame1X+10, #Frame1Y+15, 260,20, "Does not work")
StringGadget(#String1, #Frame1X+10, #Frame1Y+35, #WinWidth-40,20, "")
TextGadget(#Text2, #Frame2X+10,#Frame2Y+15, 100,20, "Works")
StringGadget(#String2, #Frame2X+10,#Frame2Y+35, #WinWidth-40,20, "")
FrameGadget(#Frame2, #Frame2X, #Frame2Y, #WinWidth-20,75, "", #PB_Frame_Flat)
ButtonGadget(#BtnQuit, #WinWidth-90,#WinHeight-50, 80,25, "Quit")
EnableGadgetDrop(#String1, #PB_Drop_Files, #PB_Drag_Copy)
EnableGadgetDrop(#String2, #PB_Drop_Files, #PB_Drag_Copy)
SetActiveGadget(#String1)
Repeat
event = WaitWindowEvent()
Select event
Case #PB_Event_Gadget
If EventGadget() = #BtnQuit
Break
EndIf
Case #PB_Event_GadgetDrop
dropped$ = StringField(EventDropFiles(), 1, #LF$)
SetGadgetText(EventGadget(), dropped$)
SetActiveGadget(EventGadget())
EndSelect
Until event = #PB_Event_CloseWindow
CloseWindow(#WinMain)