Window ID Numbers

When a Panorama window opens, it is assigned a unique ID number. It retains this number until it is closed. Once the window is closed, that ID number is not used again during that Panorama session (quitting and relaunching Panorama starts the number sequence over again). The ID number provides a constant way to identify a window that doesn’t rely on the window title, which can change. As long as the window is open, the ID number will never change.

The window ID number is not visible, but it can be accessed with a formula. To find out the ID number of the current window, use the info(“windownumber”) function.

    info("windownumber") ☞ 23

To find out the ID number of any open window, use the windowinfo( function with the `number` option, like this:

    windowinfo("Contacts","number") ☞ 14
    windowinfo("Contacts:Labels","number") ☞ 15

If the specified window is not currently open, this function will return an error. For example, if the Labels form is not currently open, this function will return an error.

    windowinfo("Contacts:Labels","number") ☞ windowinfo( error -- window “Labels” does not exist.

If you would prefer to return zero instead of an error, use the catcherror( function.

    catcherror(0, windowinfo("Contacts:Labels","number")) ☞ 0

#### Window ID Lists

To find out the ID numbers of all open windows, use the info(“windownumbers”) function. This will return a carriage return delimited text array with all of the window numbers. The window numbers are listed in order from the topmost window to the bottom, like this:

    5
    2
    1
    4
    3

The windowinfo( function allows the target window to be specified with a window ID number instead of a title. So combining these functions, a formula can be built to, for example, display the title of the window below the current window (the 2nd window in the list).

    windowinfo(val(nthline(info("windownumbers"),2)),"name") ☞ Contacts:Labels

To find out the ID numbers of all open windows belonging to a specific database, use the listwindownumbers( function. Like the info(“windownumbers”) function, this will return a carriage return delimited text array with the window numbers.

    listwindownumber("Contacts")

Other functions for getting lists of window numbers include info(“datasheetwindownumbers”), info(“formwindownumbers”) and info(“procedurewindownumbers”).

#### Bringing a Window to the Front

To make a window the active window, use the window statement with the ID number of the window you want to bring to the front. Here is a program that opens two databases, then brings the original window back to the top.

    let wasWindowNumber = info("windownumber")
    opendatabase "Contacts"
    opendatabase "Payroll"
    window wasWindowNumber

Note: In older versions of Panorama the program above would have been written by saving the window name, and using the window name as the parameter to the window statement. However this wasn’t always 100% reliable because it is possible for multiple windows to be open with the same name. The code above will always come back to the original window, even if there are other windows with the same name.

Here is another example that makes the window immediately below the current window the current window.

    window windowinfo(val(nthline(info("windownumbers"),2)),"number")

#### Window Belonging to a Form or Procedure

The getformoption( and getprocedureoption( functions allow a formula to find out whether a form or procedure is currently open, and if so, what the window ID number is. For example, here is a program that checks to see whether the Label form of the Contacts database is open, and if so, brings it forward.

    let wnumber = getformoption("Contacts","Labels","windownumber")
    if wnumber<>0
        window wnumber
    endif

The code above will open the correct window even if the window has been renamed with the windowname statement.

Clone Form Windows – The openform statement provides the option of opening multiple clone windows of a form. To find out if any clone windows of a form have been open, and what they are, you can use either the clonewindownumbers or clonewindownames option with the getformoption( function. For example, this function will list all of the currently open Panorama Help topics (the help wizard uses clone forms).

    getformoption("Panorama Help","Help","clonewindownames")

See the next section for an example using clone window numbers.

#### Accessing WindowGlobal Variables

The windowglobalvalue( function allows a formula to access variables associated with any open window. Here is a formula that lists the formulas associated with each open Formula Workshop window. The Formula Workshop uses clone windows, which are listed with the getformoption( function. Each formula wizard window stores the formula in a variable named theWizardFormula, so the value of that variable is extracted with the windowglobalvalue( function.

    arrayfilter(getformoption("Formula Workshop","Formula","clonewindownumbers"),cr(),
        {windowglobalvalue(val(import()),"theWizardFormula")})

Use the windowinfo( function to get a list of all variables associated with a window.

    windowinfo(4,"variables")

See Also

- closeclonewindow -- is an alternative method to close the current window, works even if the window has no close box.
- closedialog -- closes a form window that was previously opened with the opendialog statement.
- closewindow -- closes the current window.
- datafocus -- makes sure that Panorama is focused on data, not on a property panel.
- formtodatamode -- switches the current form window to data mode.
- formtographicsmode -- switches the current form window to graphics mode.
- getmaxwindow -- retrieves the position and size of the largest possible window on the main screen.
- getwindow -- retrieves the position and size of the current window.
- goform -- switches the current window to a different form.
- hideaccessorypanel -- closes the current window's accessory panel.
- info("accessorypanelisopen") -- returns the status of the current window's accessory panel, if any.
- info("accessorypanelwidth") -- returns the current width of the current window's accessory panel, if any.
- info("clickedwindownumber") -- returns the window number of that was just clicked.
- info("clonewindow") -- returns true if the current window was opened as a "clone" window.
- info("datasheetwindownumbers") -- returns the unique ID numbers of all open data sheet windows.
- info("datasheetwindows") -- returns a carriage return separated list of all open Data Sheet windows.
- info("dialogsheet") -- returns true if the currently active window is a dialog sheet.
- info("dropwindownumber") -- returns the number of the window that contains the form data was dropped on.
- info("formwindownumbers") -- returns the unique ID numbers of all open form windows.
- info("formwindows") -- returns a carriage return separated list of all open form windows.
- info("horizontalscrollbar") -- returns true if the current window's horizontal scrollbar is enabled, false if it is disabled.
- info("magicwindow") -- returns the name of the currently designated "magic window," if any.
- info("procedurewindownumbers") -- returns the unique ID numbers of all open procedure windows.
- info("procedurewindows") -- returns a carriage return separated list of all open procedure windows.
- info("toolbar") -- returns true if the current window's toolbar is visible, false if it is hidden.
- info("toolbarvisible") -- returns true if the current window has a visible tool bar.
- info("typeofwindow") -- determines what type of view the current window contains.
- info("verticalscrollbar") -- returns true if the current window's vertical scrollbar is enabled, false if it is disabled.
- info("windowdepth") -- returns the color depth of the current window.
- info("windowname") -- returns the name of the current window.
- info("windownumber") -- returns the unique ID number of the current window.
- info("windownumbers") -- returns the unique ID numbers of all open windows.
- info("windowoptions") -- returns the names of any currently enabled window options,
- info("windowrectangle") -- returns a rectangle defining the edges of the current window. The rectangle is in screen relative coordinates.
- info("windows") -- builds a carriage return separated text array containing a list of all the currently open windows.
- info("windowtype") -- returns a numeric value based on what type of view the current window contains.
- info("windowvariables") -- returns a carriage return separated text array listing the windowglobal variables defined for the current window.
- info("windowview") -- determines what type of view the current window contains.
- listwindownumbers( -- builds a text array containing a list of window ID numbers for all the open windows associated with a particular file.
- listwindows( -- builds a text array containing a list of all the open windows associated with a particular file.
- magicformwindow -- designates an open window as the temporary active window for the purposes of info( functions and graphic statements.
- magicwindow -- designates an open window as the temporary active window for the purposes of info( functions and graphic statements.
- makesecret -- makes the current database disappear, while leaving it open in memory.
- openclonewindow -- opens a clone of the current window.
- opendialog -- opens a form from the current database as a modal dialog box.
- opendialogsheet -- opens a form from the current database as a sheet dialog (attached to the current window).
- openform -- opens a form in the current database in a new window.
- openprocedure -- opens a procedure in the current database in a new window.
- opensavedwindows -- opens windows that were open the last time file was saved.
- opensheet -- opens the data sheet window for the current database in a new window.
- originalwindow -- goes back to the window remembered by the RememberWindow statement.
- rememberwindow -- remembers the currently active window, so that you can get back to it later.
- setactivedatabase -- makes a database active (without changing the configuration of the windows).
- setwindow -- specifies the dimensions (size and location) of the next window that is opened (with openform, opensheet, openprocedure etc.).
- setwindowoptions -- changes the attributes of the current window (tool bar, scroll bars, etc.).
- setwindowrectangle -- specifies the dimensions of the next window that is opened by a procedure.
- showaccessorypanel -- opens the current window's accessory panel.
- showrecordcounter -- forces Panorama to redisplay the record counter in all windows in the current database.
- showrectangle -- refreshes all or part of the current form window.
- size -- changes the data sheet text size.
- toggleaccessorypanel -- opens and closes the current window's accessory panel.
- topdatawindow -- brings the topmost data window in the specified database to the front.
- updatingwindow( -- returns true if in a formula that is being displayed on a form, otherwise false.
- views( -- lists views in open databases.
- window -- brings a Panorama window to the front. It can also open a "secret" invisible window.
- windowbox -- specifies the dimensions (size and location) of the next window that is opened (with openform, opensheet, openprocedure etc.).
- windowcornerinitialize -- shifts a window to an edge or corner of the main screen.
- windowinfo( -- returns information about an open window: its name, type, database, location, etc.
- windowname -- changes the name of the current window.
- windowtoback -- sends a Panorama window to the back, behind all other windows (including non-Panorama windows).
- windowtocorner -- shifts a window to an edge or corner of the main screen.
- zoomalign -- moves the current window to one of 9 positions on the computer's primary screen: *top left, top center, top right*, etc.
- zoomwindow -- moves (*"zooms"*) the current window to a new position and size.
- zoomwindowrectangle -- modifies the size, location, and options of the current window.

History

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