Applies to: Clarion 5.5 legacy chain; posted in the Clarion 5.5 group.
Problem
A customer wanted one menu choice on the application frame to close every open window (every THREAD above 1) and leave the frame open.
Solution
- A first reply:
LOOP I#=2 TO 64withPOST(Event:CloseDown,,I#)closed everything, the frame too, and in the poster's test only the last window opened on each thread. - A reply with a loop that skips the frame's thread and posts the close event up to five times per thread also closed only the last window per thread. It suggested a global queue of windows.
- The poster's own version used a global flag:
- In the frame's Preparing to Process the Window embed, store the frame's thread:
LOC:ThreadNum = THREAD(). - In the Accept loop of all browses, forms and windows:
IF GLO:CloseAllWindowsthenPOST(Event:CloseDown). - The menu embed loops over the threads, skips the frame's, posts
Event:CloseDown,,i#, setsGLO:CloseAllWindows = trueandLOC:StartTime = CLOCK(). - In the frame's Event:Timer embed (timer 100) the flag is cleared again once the time has passed.
- In the frame's Preparing to Process the Window embed, store the frame's thread:
Caveats
- The poster wrote that he still had to test more and that it was "showing promise"; he did not report back.
- The variable names in the posted snippets differ between lines, so check them before use.
- Without a clearing step, the flag keeps closing every new window.
Today (2026)
Not re-tested; the window-by-window close through an accept-loop flag is likely still the idea, but the code is dated.
Sources: Lorne C. (Apr 2001, the question), Eric J., Arnor B. (Apr 2001) in softvelocity.products.c55ee.