Windows Management Part I: Cleaning up Windows in FileMaker


I was working on a database that linked a lot of data to other data, employing many join tables. It is a database about maintaining a library of video and audio recordings of art events. The idea is to allow researchers explore and move through Artists, Events, Media Assets, Groups and Programs easily. As a result, I decided to build it so that it opens window after window. The user can jump from an Artist to an Event, or Group. After a while the screen can get cluttered, so I wanted an easy way to clean up the screen and get the user back to basics.

A Google search brought me to this thread on FMForums on how to get the count of open windows in FileMaker. Here is a demo file of how I wrote the script in my database.

Demo File – Open a Bunch of Windows

media_1321819173549.png

1) Enter the number of windows you want to mess up your screen with.
2) Click the “Open a Bunch of Windows” button.

Too many windows

media_1321818293037.png

The screen will be populated with windows.

Click the “Clean Up Windows” button to return to a single window.

media_1321819207864.png

The key to the script is:

ValueCount(WindowNames(Get(FileName))

This function gives you a count of open windows. From there, I wrapped it in a loop that Closes all Windows, but that is set to halt if there is only a single window left on screen. If you have only one window to start with, the script halts before it gets going.

Related Articles:
Windows Management Part II: How to stop the user from accidentally closing the last window in a FileMaker database
Changing Window Names based on User Input

Advertisements

5 Responses to “Windows Management Part I: Cleaning up Windows in FileMaker”

  1. Yes, but what good does the count of window names do if some are hidden? Your count may indicate that one window is still open, but the user sees only an empty screen…

    • True. I didn’t really think of this because usually someone quits from the last window and they are looking at it. It is hard to click a close or exit button from a hidden window. Still if you anticipate it being a problem, you could add some kind of conditional test in the On Close script. Something like:

      If [Get(WindowVisible)=0]
      Adjust Window [Resize to Fit]
      End If

  2. The other issue of course is that this will end the user up on a random screen. What I do – which may not be very elegant – is this:
    1) Close all windows but 1 (if you close all of them then the file closes…)
    2) Rename that window with at temporary unique title not used elsewhere (e.g. XYZ)
    3) Create a new window with desired size, name attributes etc.
    4) Close the temporary window
    That does the job!

Trackbacks/Pingbacks

  1. Changing Window Names based on User Input | HomeBase Software - July 13, 2012

    […] Articles: Windows Management Part I: Cleaning up Windows in FileMaker Windows Management Part II: How to stop the user from accidentally closing the last window in a […]

  2. Windows Management Part II: How to stop the user from accidentally closing the last window in a FileMaker database | HomeBase Software - July 13, 2012

    […] Articles: Windows Management Part I: Cleaning up Windows in FileMaker Changing Window Names based on User Input Share […]

%d bloggers like this: