this is the problem of overlapping gadgets.
That's how it works.
Code: Select all
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Procedure GadgetsClipCallBack( GadgetID, lParam )
If GadgetID
Protected Gadget = GetProp_( GadgetID, "PB_ID" )
If GetWindowLongPtr_( GadgetID, #GWL_STYLE ) & #WS_CLIPSIBLINGS = #False
If IsGadget( Gadget )
Select GadgetType( Gadget )
Case #PB_GadgetType_Unknown
Case #PB_GadgetType_ComboBox
Protected Height = GadgetHeight( Gadget )
EndSelect
EndIf
SetWindowLongPtr_( GadgetID, #GWL_STYLE, GetWindowLongPtr_( GadgetID, #GWL_STYLE ) | #WS_CLIPSIBLINGS | #WS_CLIPCHILDREN )
If Height
ResizeGadget( Gadget, #PB_Ignore, #PB_Ignore, #PB_Ignore, Height )
EndIf
SetWindowPos_( GadgetID, #GW_HWNDLAST, 0,0,0,0, #SWP_NOMOVE|#SWP_NOSIZE )
EndIf
EndIf
ProcedureReturn GadgetID
EndProcedure
CompilerEndIf
Procedure ClipGadgets( WindowID )
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
WindowID = GetAncestor_( WindowID, #GA_ROOT )
SetWindowLongPtr_( WindowID, #GWL_STYLE, GetWindowLongPtr_( WindowID, #GWL_STYLE )|#WS_CLIPCHILDREN )
EnumChildWindows_( WindowID, @GadgetsClipCallBack(), 0 )
CompilerEndIf
EndProcedure
;after use SetParent_(win2,win1) , how correctly show win2 ?
win1=OpenWindow(1,0,0,380,350,"",#PB_Window_ScreenCentered)
ButtonGadget(0,11,11,222,22,"Button")
TextGadget(1,11,41,222,22,"Text")
StringGadget(2,11,71,222,22,"String")
ContainerGadget(10, 8, 98, 306, 133, #PB_Container_Raised)
ButtonGadget(11, 10, 15, 80, 24, "Button 11")
ButtonGadget(12, 95, 15, 80, 24, "Button 12")
CloseGadgetList()
win2=OpenWindow(2,0,0,180,150,"2",#PB_Window_SystemMenu);,#PB_Window_WindowCentered,w1)
ButtonGadget(52, 25, 15, 80, 24, "Button 12")
SetParent_(win2,win1)
ClipGadgets(win1)
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow
I often asked Fred, but he does not hear.