Drag'n'Drop on Container inside Frame doesn't work

Just starting out? Need help? Post your questions and find answers here.
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Drag'n'Drop on Container inside Frame doesn't work

Post by Fred »

Overlapping gadgets are not supported in PB, so you need to use the new #PB_Frame_Container flag to have it working:

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
Post Reply