Code : Tout sélectionner
Global Window_0, Window_1, Window_2
Global Button_1, Button_2, Button_101, Button_102, Button_201, Button_202
Procedure OpenWindow_0(x = 300, y = 0, width = 600, height = 400)
Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
Button_1 = ButtonGadget(#PB_Any, 20, 200, 260, 100, "Option 1")
Button_2 = ButtonGadget(#PB_Any, 300, 200, 260, 100, "Option 2")
EndProcedure
Procedure OpenWindow_1(x = 0, y = 400, width = 600, height = 400)
Window_1 = OpenWindow(#PB_Any, x, y, width, height, "Options 1", #PB_Window_Tool)
Button_101 = ButtonGadget(#PB_Any, 20, 200, 260, 80, "Win 1 : Option 1")
Button_102 = ButtonGadget(#PB_Any, 300, 200, 260, 80, "Close")
EndProcedure
Procedure OpenWindow_2(x = 500, y = 400, width = 600, height = 400)
Window_2 = OpenWindow(#PB_Any, x, y, width, height, "Options 2", #PB_Window_Tool)
Button_201 = ButtonGadget(#PB_Any, 20, 200, 260, 80, "Win2 : Option 1")
Button_202 = ButtonGadget(#PB_Any, 300, 200, 260, 80, "Close")
EndProcedure
Procedure Window_0_Events(event)
Select event
Case #PB_Event_CloseWindow
ProcedureReturn #True
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case Button_1
OpenWindow_1()
Case Button_2
OpenWindow_2()
EndSelect
EndSelect
ProcedureReturn #False
EndProcedure
Procedure Window_1_Events(event)
Select event
Case #PB_Event_CloseWindow
CloseWindow(Window_1)
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case Button_101
Debug "Click Bouton Win1"
Case Button_102
CloseWindow(Window_1)
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure
Procedure Window_2_Events(event)
Select event
Case #PB_Event_CloseWindow
CloseWindow(Window_2)
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case Button_201
Debug "Click Bouton Win2"
Case Button_202
CloseWindow(Window_2)
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure
Quit = #False
OpenWindow_0()
Repeat
Event = WaitWindowEvent(20)
NoWin = EventWindow()
If Event
Select NoWin
Case Window_0
Quit = Window_0_Events(event)
Case Window_1
Window_1_Events(event)
Case Window_2
Window_2_Events(event)
EndSelect
EndIf
Until quit = #True