Why? Because
1) when you close the window from another window popup notification is not it, that is, software that does not track.
2) at the exit from the cycle again, no popup notification about this, that is that the program is closed.
Code: Select all
Enumeration #PB_Event_FirstCustomValue
#PB_Event_Quit
EndEnumeration
Procedure CloseWindowAll()
CloseWindow(#PB_All)
EndProcedure
Procedure CloseWindowEx( Window )
If Window = #PB_All
PostEvent( #PB_Event_Quit, EventWindow(), #PB_Ignore ) ; - 1 bug
BindEvent( #PB_Event_Quit, @CloseWindowAll(), EventWindow())
Else
If EventWindow() = Window And Not IsGadget(EventGadget())
If IsWindow( Window )
ProcedureReturn CloseWindow( Window )
EndIf
Else
PostEvent( #PB_Event_CloseWindow, Window, #PB_Ignore ) ; - 1 bug
ProcedureReturn WindowID(Window)
EndIf
EndIf
EndProcedure
Macro CloseWindow( Window )
CloseWindowEx( Window )
EndMacro
X = 100
Global Dim ArrayId.l(4)
Global Event
Procedure CloseAllWindow(*value)
For i = 1 To 4
Delay(1000)
SetActiveWindow(ArrayId(i))
CloseWindow(ArrayId(i))
Debug i
Next
EndProcedure
For i = 1 To 4
ArrayId(i) = OpenWindow(#PB_Any, X, 200, 150, 50, "Window" + Trim(Str(i)))
X + 300
Next
CreateThread(@CloseAllWindow(), 0)
While Event ! #PB_Event_Quit
Event = WindowEvent()
Delay(10)
If Event = #PB_Event_CloseWindow
If UseGadgetList(0) = WindowID(EventWindow())
CloseWindow(#PB_All)
Break
Else
CloseWindow(EventWindow())
EndIf
EndIf
Wend
Debug "Quit"
MessageRequester("Kcc-MegaBig-Software :-)", "It's ending")
Code: Select all
Enumeration #PB_Event_FirstCustomValue
#PB_Event_Quit
EndEnumeration
Procedure CloseWindowEx( Window )
If Window = #PB_All
PostEvent( #PB_Event_Quit, EventWindow(), #PB_Ignore ) ; - 1 bug
CloseWindow( #PB_All ) : OpenWindow( #PB_All, 0,0,0,0, "", #PB_Window_Invisible )
Else
If EventWindow() = Window
If IsWindow( Window )
ProcedureReturn CloseWindow( Window )
EndIf
Else
PostEvent( #PB_Event_CloseWindow, Window, #PB_Ignore ) ; - 1 bug
ProcedureReturn WindowID(Window)
EndIf
EndIf
EndProcedure
Macro CloseWindow( Window )
CloseWindowEx( Window )
EndMacro
X = 100
Global Dim ArrayId.l(4)
Global Event
Procedure CloseAllWindow(*value)
For i = 1 To 4
Delay(1000)
SetActiveWindow(ArrayId(i))
CloseWindow(ArrayId(i))
Debug ""+i + " - " + ArrayId(i)
Next
EndProcedure
For i = 1 To 4
ArrayId(i) = OpenWindow(#PB_Any, X, 200, 150, 50, "Window" + Trim(Str(i)))
X + 300
Next
CreateThread(@CloseAllWindow(), 0)
Procedure Quit()
Debug "Quit "+" Window"+EventWindow() ; +CountWindow()
EndProcedure
BindEvent( #PB_Event_Quit, @Quit())
While Event <> #PB_Event_Quit
Event = WindowEvent()
Delay(10)
If Event = #PB_Event_CloseWindow
If UseGadgetList(0) = WindowID(EventWindow())
CloseWindow(#PB_All)
Else
CloseWindow(EventWindow())
EndIf
EndIf
Wend
Debug "Quit "+EventWindow()
MessageRequester("Kcc-MegaBig-Software :-)", "It's ending")
End