I've written a program that opens a number of windws. Each is opened using a %lw statement that specifies and (integer) control variable - a different %lw and a different variable for each window. A sample of this is:
i=winio@('%lw&',IFirstWinClosed)
There is also a %ww statement for each window, saying:
i=winio@('%ww[not_fixed_size,independent]&')
so that the windows can be resized and I can move from window to window during the program execution.
Each window comes with a small red X button in the upper right corner, that is automatically placed there by the system. Clicking it closes that window, but does not close any other window. This is normal, and it's what I want that small X to do.
In the first window, I'd like to place a larger button labeled EXIT, near the bottom of the window. When clicked, this EXIT button will close ALL the windows and terminate the program.
i=winio@('%^bt[Exit]&',ExitBtn)
The callback function for this EXIT button sets the control variables for each window to a positive number, and then calls window_update@ for each control variable:
INTEGER FUNCTION ExitBtn()
COMMON/WinCtls/IFirstWinClosed,IOutEditWinClosed,IStatusWinClosed
1 ,IBOMInqWinClosed,ICompInqWinClosed
C
C* Close all windows.
IFirstWinClosed=1
IOutEditWinClosed=1
IStatusWinClosed=1
IBOMInqWinClosed=1
ICompInqWinClosed=1
CALL window_update@(IFirstWinClosed)
CALL window_update@(IOutEditWinClosed)
CALL window_update@(IStatusWinClosed)
CALL window_update@(IBOMInqWinClosed)
CALL window_update@(ICompInqWinClosed)
ExitBtn=1
END
I have found that this code successfully closes all windows EXCEPT the first one - the one the large EXIT button is in. That first window remains open, and the program execution is not terminated.
I have also found that if I modify the statement that created the large EXIT button, to read:
i=winio@('%^bt[Exit]&','EXIT')
invoking the standard callback function EXIT instead of my hand-written callback function ExitBtn, then the large EXIT button does close the first window (the one the button is in), but does not close any of the others.
I have tried adding a STOP statement to this callback function before the END statement. Also tried adding a CALL EXIT(Ierr) statement in the same place. Neither seems to have any effect - the callback function still closes all windows except the one it's in (the first window).
Is there a way I can make this large EXIT button close ALL windows, including the one it's in, and terminate the program?