Code : Tout sélectionner
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;- Window Constants
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Enumeration
#Window_0
#Window_1
#Window_2
#Window_3
#Window_4
#Window_5
EndEnumeration
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;- Gadgets Constants
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Enumeration
#Win1
#Win2
#Win3
#Win4
#Win5
#CloseWin
EndEnumeration
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;- Ouverture de la fenetre principale
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If OpenWindow(#Window_0, 0, 0, 370, 80, "Window 0", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
ButtonGadget(#Win1, 10, 10, 70, 25, "window 1",0)
ButtonGadget(#Win2, 80, 10, 70, 25, "window 2",0)
ButtonGadget(#Win3, 150, 10, 70, 25, "window 3",0)
ButtonGadget(#Win4, 220, 10, 70, 25, "window 4",0)
ButtonGadget(#Win5, 290, 10, 70, 25, "window 5",0)
ButtonGadget(#CloseWin, 10, 40, 350, 25, "Close window",0)
EndIf
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;- Boucle
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_Gadget
Select EventGadget()
Case #Win1
OpenWindow(#Window_1, 0, 0, 100, 100, "Window 1", 0) ; ouvre la fenetre Window 1
Case #Win2
OpenWindow(#Window_2, 150, 0, 100, 100, "Window 2", 0)
Case #Win3
OpenWindow(#Window_3, 300, 0, 100, 100, "Window 3", 0)
Case #Win4
OpenWindow(#Window_4, 450, 0, 100, 100, "Window 4", 0)
Case #Win5
OpenWindow(#Window_5, 600, 0, 100, 100, "Window 5", 0)
Case #CloseWin
If IsWindow(#Window_1) > 0 ; si differant de 0 alors la fenetre #Window_1 est ouverte
CloseWindow(#Window_1) ; on la ferme
EndIf
If IsWindow(#Window_2) > 0
CloseWindow(#Window_2)
EndIf
If IsWindow(#Window_3) > 0
CloseWindow(#Window_3)
EndIf
If IsWindow(#Window_4) > 0
CloseWindow(#Window_4)
EndIf
If IsWindow(#Window_5) > 0
CloseWindow(#Window_5)
EndIf
EndSelect
EndIf
Until EventID = #PB_Event_CloseWindow