Created On:  22 September 2011
 
CloseWindows() works from the first-opened window to the last-opened window, so in the situation where the first-opened window (the 'grandparent') has a child window (the 'parent') where the parent must be closed before the grandparent can be closed and the parent has a child window that must be closed before the parent window can be closed, then CloseWindows() will fail.

To resolve this problem, add the following code into the main window declaration:-

[-] window MainWin MyAppWindow
  [ ]
  [-] void CloseWins()
    [ ] list of window lwOpenWindows
    [ ] window wWin
    [ ] int i=0
    [ ]
    [ ] lwOpenWindows=this.GetCloseWindows()
    [-] for(i=ListCount(lwOpenWindows);i>=1;i--)
      [ ] wWin=lwOpenWindows[i]
      [ ] wWin.Close()

To call the function:-

MyAppWindow.CloseWins()

This will ensure that the windows are closed from the top down.
Incident #2537482