windowglobal
VARIABLES

The windowglobal statement creates one or more windowglobal variables.


Parameters

This statement has one parameter:

variables – is a list of variables to be created. Each variable should be separated from the next by a comma. If a variable name contains spaces or punctuation it should be surrounded by chevron (« ») characters.


Description

This statement creates one or more variables that are specific to the current window. Window global variables may be used by any procedure as long as the same window is open, and remain active until you close the window.

The windowglobal statement reduces the chance for conflict between variables in the same database. It allows you to define the same variable name over and over again in different windows, with each window having a separate value. This is very useful when using window clones.

Window Clones

Panorama normally allows only a single window per form. However, a single form can be opened over and over again into multiple separate windows by using the openform statement with the “clone” option.. Each window is a “clone” of the others. A window clone cannot be opened manually with the View menu - only with openform statement in a procedure. Here is a typical procedure that opens a slightly offset clone of the current window:

setwindowrectangle rectangleadjust( info("windowrectangle"),10,10,10,10))
openform info("formname"),"Clone",true()

In Panorama 6 and earlier versions, a form could only be opened as a form if the Allow Clones preference was turned on, but this option is no longer necessary (or available) in Panorama X. Instead, the clone option is specified as a parameter of the openform statement.

Designing Forms for Clone Windows

Although any form can be opened as a clone, most forms will not work very intelligently if they are cloned. In general, a form that is designed to be cloned should not contain any fields or global variables, only windowglobal variables. If your form contains objects that are linked to a variable and is opened with the clone option, the objects will automatically create windowglobal variables instead of global variables. Since the windowglobal variables can be manipulated separately for each clone window, you can control each clone window individually, even though all the clone windows use the same form template.

The example assumes that you have created a form called File Display that displays the contents of a text file using a Text Display object with the formula

fileload(wFolder,wFile)

The procedure below will open a new window and display the file.

local folder,file,type
openfiledialog folder,file,type,"TEXT"
if file="" stop endif
openform "File Display","clone","yes"
windowname file
windowglobal wFolder,wFile
wFolder=folder
wFile=file
showvariables wFolder,wFile

Each time you run this procedure, another window will open.


See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0, but documents changes in clone window operation from Panorama 6 to X.