Windows are the top-level unit of design for Vision projects. A window is identified by its path, which is the name of all its parent folders plus its name, with forward slashes (/) in between. For example, the path to a window in the top level called MainWindow would simply be its name, whereas the path to a window named UserOptions under a folder called OptionsWindows would be: OptionsWindows/UserOptions.
A window may display a Titlebar and/or a Border. The titlebar allows the user to drag the window around in the client, and houses the window's close and maximize/restore buttons. The border of a window can be used to resize the window in the client when it is floating or docked. Whether on not the titlebar and border are displayed depends on the values of the window's titlebar and border display policy properties, and its current state. Commonly, a window will display both a titlebar and border when it is configured as a popup. It is often desirable to remove titlebars and borders on main windows so they join seamlessly with docked windows.
The user manual describes different Window Types, but technically there is only a single window object in the Vision module: different "types" of windows are simply instances of the window object configured in different ways. See Window Types for more information about changing types.
Inside a window is always the Root Container. The Root Container is where you will place all of your components in the window. This is exactly the same as a normal container component except that it cannot be deleted. When in the designer, "resizing" the window from the main Vision workspace is really changing the size of the Root Container.
Window Opening Event Order
Window objects have several event handlers that trigger when the window opens. However, each event handler occurs at a separate time. Because of this, it is important to understand the order that these events occur:
Opening a window - When opening a window for the first time in a designer, the following event handlers are called in order:
- visionWindowOpened - Important to notice the description on this event: it occurs before any bindings on the window are evaluated.
- internalFrameOpened - If the window has been cached, this will not fire on sequential opens.
- internalFrameActivated - The last event, but also repeatable while the window is opened, since this event will trigger again if the window loses and then regains focus without being closed in between.
Closing a window - When closing a window, the following event handlers are called in order:
- internalFrameClosing - This event would be ideal to "clean up" in the window, since the window is still technically open at this point.
- visionWindowClosed - Triggers when the window is closed. Functionally, this is similar to internalFrameClosed, but happens slightly earlier.
- internalFrameDeactivated - This triggers when the window is closed, or when the window loses focus, so you may want to avoid this event if your script should only trigger when the window is closed.
- internalFrameClosed - Similar to visionWindowClosed. Triggers when the Java windowing system has finished closing the window.