EnableWindowDrop() - Problem with Thread, ParentID, Flags
Posted: Thu Dec 30, 2010 12:41 am
Code: Select all
Enumeration
#MainWindow = 10
#MainFrame
#MainImageGadget
#SubWindow = 20
#SubFrame
#SubImageGadget
EndEnumeration
Procedure SubWindow(Void)
;If OpenWindow(#SubWindow, #PB_Ignore, #PB_Ignore, 300, 300, "Sub Window", #PB_Window_WindowCentered, WindowID(#MainWindow))
If OpenWindow(#SubWindow, #PB_Ignore, #PB_Ignore, 300, 300, "Sub Window (Borderless)", #PB_Window_BorderLess | #PB_Window_WindowCentered, WindowID(#MainWindow))
SetWindowColor(#SubWindow, 123456)
EnableWindowDrop(#SubWindow, #PB_Drop_Files, #PB_Drag_Copy)
;Frame3DGadget(#SubFrame, 0, 0, 300, 300, "");, #PB_Frame3D_Flat)
; DisableGadget(#SubFrame, #True) ; Flat-Style error: Needs to be disabled for gadget drop BUT creates redrawing issues
ImageGadget(#SubImageGadget, 80, 80, 140, 140, 0, #PB_Image_Border)
EnableGadgetDrop(#SubImageGadget, #PB_Drop_Files, #PB_Drag_Link)
Repeat
Select WaitWindowEvent(40)
Case #PB_Event_GadgetDrop
Debug "Sub: Drop on gadget " + Str(EventGadget())
Case #PB_Event_WindowDrop
Debug "Sub: Drop on window " + Str(EventWindow())
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
EndIf
EndProcedure
If OpenWindow(#MainWindow, #PB_Ignore, #PB_Ignore, 400, 400, "Main Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
SetWindowColor(#MainWindow, 654321)
EnableWindowDrop(#MainWindow, #PB_Drop_Files, #PB_Drag_Copy)
;Frame3DGadget(#MainFrame, 0, 0, 400, 400, "");, #PB_Frame3D_Flat)
; DisableGadget(#MainFrame, #True) ; Flat-Style error: Needs to be disabled for gadget drop BUT creates redrawing issues
ImageGadget(#MainImageGadget, 130, 130, 140, 140, 0, #PB_Image_Border)
EnableGadgetDrop(#MainImageGadget, #PB_Drop_Files, #PB_Drag_Link)
CreateThread(@SubWindow(), 0)
Repeat
Select WaitWindowEvent(40)
Case #PB_Event_GadgetDrop
Debug "Main: Drop on gadget " + Str(EventGadget())
Case #PB_Event_WindowDrop
Debug "Main: Drop on window " + Str(EventWindow())
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
EndIfBy the way: There is also a bug with the Frame3DGadget(). The gadget won't receive the drop-event when flat style is enabled and the workaround (DisableGadget() for the frame) creates redrawing issues.