Newly Opened Database Window Arrangement

When a database is first opened (for example by double clicking it, choosing it from the File>Recent menu, or using the Open File menu command), Panorama normally opens the database with the same window arrangement it had the last time it was open. In other words, the same windows will open in the same location. If opening the previous window arrangement is fine with you, you can skip the rest of this topic.

### Initial Windows

If you prefer to have the same windows open each time no matter what windows were open previously, use the Initial Windows option in the File>Database Options>General panel. If the Initial Windows option is empty, Panorama will open whatever windows were open the last time the database was open. But if you provide a list of one or more windows, Panorama will open only those windows and no others (of course you can use the View menu to open additional windows later).

The list of windows is text, so you can type items into the list or edit it. To add a form to the list, type `FORM:` followed by the name of the form (or use `CLONEFORM:` if you want to open the form as a clone window, see openform). The form name must be typed in exactly, including upper and lower case. The list of initial windows can also include one or more procedures, type `PROCEDURE:` followed by the name of the procedure (again, the name must be exact, including the exact capitalization).

To help you type in window names exactly, use the Add Window pop-up button. Select the item you want and it will be typed in to the list (only the data sheet and forms are included in the pop-up menu, procedures must be typed in manually).

If you want to go back to the default mode (automatically restoring the open windows), simply delete the entire list.

Note: Panorama will not necessarily open the windows in the order you list them. There is no way to control the exact window order, however, you could use the .Initialize procedure to bring a specific window to the front.

Note: The Initial Windows list specifies only the window names, not their positions and size. For form windows, the position and size can be specified as part of each form’s properties, as described in the next section. The position and size are not part of the database options, but rather the form options.

### Initial Form Window Position & Size

When you close any Panorama window, Panorama remembers the position and size of the window. The next time the window is re-opened, the window will appear in the same location with the same size (this happens whether the window is opened with the View menu or by opening the database).

For form windows, however, you have the option to explicitly specify the position and size of the window when the form is opened. To do this, go into Graphics Mode and fill in the desired coordinates in the Initial Dimensions property. (If you don’t know the exact numeric coordinates you want, you can ask Panorama to measure the current window dimensions for you, see Measuring the Dimensions of a Window below.)

Once you’ve set the initial dimensions, this form will always open to this exact spot when you open the database or open the form with the View menu. (However, you can still write code using the openform statement to open the form to a different spot.)

If you want to go back to Panorama remembering the position and size, simply delete the Initial Dimensions property and leave it blank.

Note: Both the top and left positions must be 1 or greater. You cannot use zero as an initial window position.

#### Initial Form Size

When setting up the Initial Dimensions property, you can omit the top and left coordinates and include only the height and width. If you do this, the form will always open at the specified height and width, but the position (top and left) will be saved from the last time the window was open.

#### Calculating the Initial Form Position & Size

The technique described above allows you to set up a fixed initial window position. But what if you want to calculate the window position & size on the fly? For example, supposed you want to open the window in the center of the monitor, no matter what the monitor size is. To do this you’ll need to set up the `formRECTANGLE:` form event procedure. This example creates a window that is 600 points high by 800 wide, centered in the middle of the main monitor. This code should not do anything other than calculate the dimensions, which must be returned using the functionvalue statement.

Notice that the Initial Dimensions option was left empty. If it is not empty, it will be ignored, the `formRECTANGLE:` code overrides the Initial Dimensions.

Here is a more advanced example that uses the rectangletweak( function. With this code the window will also be centered on the main monitor, but the height will automatically adjust to fill 80% of the height of the monitor:

To learn more about this topic, see Form Event Procedures on the Implicitly Triggered Procedures page.

#### Preventing Resizing of a Window

If you want the window height to fixed so that it can’t be changed after it opens, set the minimum and maximum height to the same value. Use the same technique to keep the width fixed. This example opens the window to a width of 800 points (see above) and then doesn’t allow the width to be changed. The height, however, can be adjusted, though not to less than 400 points.

#### Measuring the Dimensions of a Window

To measure the dimensions of a window, use the Window>Window Dimensions menu item. This will display the coordinates of the window, like this:

If you press the Copy button, Panorama will copy the window dimensions into the clipboard in a format that is compatible with the Initial Dimensions form property. So you can position the window exactly as you want it, copy the dimensions, then paste them into the Initial Dimensions. From then on, the form will always open to that exact position and size.

### Customizing a Form Window Title

By default, each form window is titled with the database and form name, separated by a colon, as shown here:

This title can be customized by setting up a `formWINDOWTITLE:` form event procedure. The code in this procedure should not do anything other than calculate the title, then return the title using the functionvalue statement. This example will set the the title to simply Hobby Catalog.

After adding this code, you can simply close and re-open the form (or the entire database) and it will automatically display the new title whenever this form is opened:

In this example the window title is set to a fixed value, but you can use any formula you want. For example, you could keep the window title in a permanent variable. (Keep in mind, however, that changing the permanent variable will not immediately change the window title – the change will not appear until the next time the window is opened. See the next section to learn how to immediately change the window title.)

To learn more about this topic, see Form Event Procedures on the Implicitly Triggered Procedures page.

#### Dynamically Changing the Window Title

To change the window title after the form is already open, use the windowname statement. This allows to to change the window title any time you want. However, keep in mind that the effect of the windowname statement is immediate but temporary – Panorama doesn’t remember the effect of this statement when the window has been closed and reopened.

History

Version | Status | Notes
10.2 | New | New in this version.