When a window is closed, I can find out, if there are other windows, which are still open and I can close them. Then the application is really terminated. This I want to happen, when I click to the Close Button.
But when I close a window by program-code the close-event is firing as well and the program is closed down.
How can I find out, if it was the close button or a program-code, which fired the close-event?
You can set a flag when you close the window in code and check that flag in the close event. Add a method to each window that you call to close it in code.
Sub CloseWindow
ClosingFlag = True
self.close
ClosingFlag = False
End Sub
In the window Close event
if ClosingFlag then return
// close all the other windows here