Closing all open windows from a frame menu item while keeping the application frame open

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

  1. A first reply: LOOP I#=2 TO 64 with POST(Event:CloseDown,,I#) closed everything, the frame too, and in the poster's test only the last window opened on each thread.
  2. 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.
  3. 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:CloseAllWindows then POST(Event:CloseDown).
    • The menu embed loops over the threads, skips the frame's, posts Event:CloseDown,,i#, sets GLO:CloseAllWindows = true and LOC:StartTime = CLOCK().
    • In the frame's Event:Timer embed (timer 100) the flag is cleared again once the time has passed.

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.