openform
FORM
,
OPTION
,
VALUE

The openform statement opens a form in the current database in a new window.


Parameters

This statement has three parameters:

form – is the name of the form to open.

option – in addition to the form name, this statement can have one or more additional option/value parameter pairs that modify the operation of the statement. Each pair has two parts, the option name (this parameter) and the option value. See the discussion below for more information.

value – option value.


Description

This statement opens a form in a new window. If the specified form is already open, it is simply brought to the front.

By default, the form will open in the same location it was in the last time it was opened. To specify the size and location of the new window in advance, use the setwindowrectangle, setwindow, or windowbox statements.

The procedure below opens the form Application in a 4 inch by 6 inch window centered on the main screen.

local newWindowRect
newWindowRect=rectanglecenter(
    info("screenrectangle"),
    rectanglesize(1,1,4*72,6*72))
setwindowrectangle newWindowRect,""
openform "Application"

Options

In addition to the form name, this statement can have one or more additional option/value parameter pairs that modify the operation of the statement. For example, these options can modify the appearance and operation of the window that will contain the form. Each pair has two parts, the option name (this parameter) and the option value, like this:

openform name,option,value,option,value,option,value

The available options are described below.

Database

To open a form in a different database, use the database option. This example opens the form Report from the Members database.

openform "Report","Database","Members"

The specified database must already be open.

Stay

Normally when you use the database option, the current database changes to the the specified database while the form is open. However, if you also specify that stay is true, the current database will remain active. If you use this option, make sure that the form you are opening doesn’t display or edit fields that are not in the current database. Usually you will use this option with forms that don’t use any fields, only variables. In this example, the Status form from the Utility database is opened, but Utility does not become the current database – the current database stays the same (hence the name of the option).

openform "Status","Database","Utility","Stay",true(),"Clone",true()

As shown in the example above, the stay option is often used with the clone option (see below).

Title

To customize the window title, use the title option. (The title normally displays the database and form name.) This example opens the window with the name Latest Report.

openform "Report 183B","Title","Lastest Report"

If you want to change the title later, use the windowname statement.

Clone

This true/false option specifies whether the form should be opened as a “clone” window. You can open multiple clone windows with the same form – each window will operate independently. When a window is opened as a clone it cannot be switched into graphics mode. If you modify the graphic objects in a clone form window, those changes will not be saved once the window has closed, and the changes will not appear in other clone windows that are associated with the same form.

This example will open three different label windows.

openform "Label","Clone",true(),"Title","Label1"
openform "Label","Clone",true(),"Title","Label2"
openform "Label","Clone",true(),"Title","Label3"

If you want different clone windows to display and/or work with different data, use windowglobal variables. Each window has its own separate windowglobal variables.

Note: Unlike Panorama 6 and earlier, Panorama now allows any form to be opened as a clone window, but you must use the clone option.

Variables

This option allows sets up one or more windowglobal variables in the new window. Both the names and values of the variables are initialized just before the window actually opens, so you can use these variables in graphical objects in the form (Text Display, Image Display, etc.). You must create a dictionary that contains the names and values of all of the variables you want to create, as shown in the example below.

For example, suppose you wanted to make a window that worked like the Finder’s Get Info window. You could use code like this to select a file and open a form displaying information about the selected file. Since this is a clone window, you could use this procedure multiple times to open multiple windows, each displaying information about a different file. Each window will have its own separate getInfoFilePath windowglobal variable, allowing each window to display information about a different file.

local fileChoice
choosefileDialog fileChoice
if fileChoice="" return endif
openform "File Information",
    "Clone",true(),
    "variables",initializedictionary("getInfoFilePath",fileChoice)

Without the variables option, you would have to use letwindowglobal to set up the variable, and then use showvariables to display it. This causes a slight “flash” when the window opens. Using the variables option eliminates this flash because the variable (or variables) are created just before the window actually opens, instead of after the window opens.

Rectangle

Panorama normally opens a form in the same location it was in the last time it was open. This option allows you to specify the exact location and size of the new form window. This example opens a 3" by 5" form window in the upper left hand corner of the screen.

openform "Label","Rectangle",rectanglesize(20, 5, 72*3, 72*5)

Note: The location can also be specified with the setwindowrectangle statement. If both are used, the rectangle specified in the openform statement will be used.

Toolbar

Panorama normally remembers whether the toolbar was visible the last time a form window was open. This option allows you to explicitly specify whether the toolbar should be visible in the new window. This example hides the toolbar in the new Label form window.

openform "Label","Toolbar",false()

Note: Toolbar visibility can also be specified with the setwindowrectangle statement. If both are used, the option specified in the openform statement will be used.

Scrollbars

Form windows normally have scroll bars unless they have been disabled with the inspector panel. You can also disable them (or enable them, if they have been disabled) explictly when opening a form. This example turns off all scroll bars and the toolbar when opening the Label form.

openform "Label","Scrollbars",false(),"Toolbar",false()

You can also enable the vertical and horizontal scroll bars separately.

openform "Sign Up","VerticalScrollBar",true(),"HorizontalScrollBar",false()

Note: You can abbreviate these option names, for example "VScroll", "VertScroll", "HorzScrollBar" etc. As long as the option name contains scroll and begins with v or h you are good to go.

Note: Scrollbars can also be specified with the setwindowrectangle statement. If both are used, the option specified in the openform statement will be used.

Maximizable

This true/false option controls whether or not the maximize button (the green button in the upper left corner of the window) is enabled. This button is enabled by default, so this option allows you to turn it off.

openform "New Customer","Maximizable","no"

Closeable

This true/false option controls whether or not the close button (the red button in the upper left corner of the window) is enabled. This button is enabled by default, so this option allows you to turn it off.

openform "New Customer","Closeable","no"

Once you’ve opened a form without a close button, the only way to close it is by closing the entire database. You no longer have the option to close just that window, even with a program. However, you can use the setwindowoptions statement to re-enable the close button and close the window, like this:

setwindowoptions "Closeable","yes"
closewindow

See also the closewindow statement.

Note: The code example above assumes the window you want to close is currently on top.

Minimizable

This true/false option controls whether or not the minimize button (the yellow button in the upper left corner of the window) is enabled. This button is enabled by default, so this option allows you to turn it off.

openform "New Customer","Minimizable","no"

FullScreen

This true/false option controls allows you to remove the fullscreen button (on OS X 9 this button is in the upper right hand corner of the window).

openform "New Customer","fullscreen","no"

NoButtons

This true/false option controls allows you to completely remove all of the buttons at the top of the window.

openform "New Customer","NoButtons","yes"

NoIcon

This true/false option controls allows you to remove the icon just to the left of the window title (at the top of the window).

openform "New Customer","noicon","yes"

NoVersionButton

This true/false option allows you to remove the caret icon just the the right of the window title (at the top of the window), and removes the ability to click on the title to rename the document, or to Command-Click on the title to see the path to this document.

openform "New Customer","noversionbutton","yes"

TitleBar

This true/false option option allows you to completely remove the title bar at the top of the window, including all of the buttons in the title bar.

openform "New Customer","TitleBar","no"

Shadow

This true/false option option allows you to remove the shadow around the window.

openform "New Customer","Shadow","no"

WindowsMenu

This true/false option option allows you to keep the window out of the Windows menu.

openform "New Customer","WindowsMenu","no"

See Also


History

VersionStatusNotes
10.2UpdatedNew option "Variables" allows windowglobal variables to be set up just before the window actually opens. New option "NoVersionButton".
10.0UpdatedCarried over from Panorama 6.0, but now includes options for opening forms from another database and modifying the appearance and operation of the form's window.