Simple database systems may be easily contained within a single window, but you don’t have to get too terribly complicated before popping a new window makes a lot a sense. Whether it’s an off-screen window for creating a related record or a specialized dialog box to guide a user through a tricky process, the single window interface isn’t always practical. But with the flexibility of multiple windows comes the responsibility of managing them.
WindowNames is your window to window wrangling. When invoked, WindowNames produces a return-separated list of the windows associated with the current file. While it’s rare to need a list of window names for a file that you’re not currently in, it is possible.
Where WindowNames becomes quite handy is in your window management scripts. Say you have a helper window that could be invoked from a few different portions of the database. If you just use a New Window script step every time you need this helper, you could very well end up with a dozen instances of that same window and some very confused users.
This little snippet of script illustrates one way to check for an existing window before opening a new one.
The If step just says “get a list of window names for the current file, and tell me if “My Handy Window” is not there”. If My Handy Window is indeed absent, the next step creates it. On the other hand, if My Handy Window already exists, just select it to bring it to the front.