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.
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.
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"
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"
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"
This true/false option option allows you to keep the window out of the Windows menu.
openform "New Customer","WindowsMenu","no"
See Also
- activeobjectaction -- allows a procedure to communicate with the object on the current form that is currently being edited (if any).
- automaticprocedurename( -- returns an available procedure name.
- changeobject -- modifies the properties of one object in a form.
- changeobjects -- modifies the properties of one or more objects in a form.
- changetimer -- modifies a repeating task that will be performed periodically when Panorama is not otherwise busy.
- cloneform -- copies all of the objects in a form (optionally, with modifications) into the active form.
- cloneobjects -- duplicates objects in a form (with modifications).
- closeactiveobject -- closes any object whose text is currently being edited.
- closeclonewindow -- is an alternative method to close the current window, works even if the window has no close box.
- closedatabaseactiveobjects -- stops all text editing associated with the current database.
- closedialog -- closes a form window that was previously opened with the opendialog statement.
- closewindow -- closes the current window.
- controlsound -- controls playback of a sound file.
- datafocus -- makes sure that Panorama is focused on data, not on a property panel.
- downloadpartialdatabase -- downloads specified components of the current database from the server. The current database must be shared.
- exportallprocedures -- saves all the procedures in an editable text format.
- exportprocedure( -- exports a procedure and the procedure's meta data as a binary object that can be imported with the importprocedure statement.
- formtodatamode -- switches the current form window to data mode.
- formtographicsmode -- switches the current form window to graphics mode.
- formxy -- programmatically scrolls a form to a new position.
- getmaxwindow -- retrieves the position and size of the largest possible window on the main screen.
- getprocedureoption( -- returns information about a procedure.
- getproceduretext -- gets the contents (source) of a procedure and places it in a variable.
- getproceduretext( -- gets the contents (source code) of a procedure.
- 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.
- Implicitly Triggered Procedures -- Procedures that are triggered automatically when the user performs some normal Panorama action are said to be "implicitly triggered."
- importdatabase -- imports data from another database into the current database.
- importdictprocedures -- converts source code exported by the ExportAllProcedures statement into a dictionary.
- importjson -- imports a JSON array into the current database.
- importjsonline -- imports a JSON record into the current record.
- importline -- imports a line of text into the current record.
- importprocedure -- imports a procedure into a database.
- importrawdata -- imports raw binary data into an existing database.
- importtext -- imports text into an existing database.
- 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("proceduredatabase") -- returns the name of the database that contains the currently running procedure.
- info("procedurename") -- returns the name of the currently running procedure.
- 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.
- join -- joins data from another database into the current database.
- joinonerecord -- joins matching data from another database into the current record.
- 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.
- loadallprocedures -- loads all the procedures from a dictionary into the current database.
If a procedure doesn't exist it will be created.
- 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.
- makenewform -- creates a new form in the current database.
- makenewprocedure -- creates a new procedure in the current database.
- makesecret -- makes the current database disappear, while leaving it open in memory.
- Mark Menu -- allows you to set bookmarks in source code to help navigate to specific spots in a long program.
- newdatabase -- creates a new database.
- newformobject -- creates a new graphic object in a form.
- objectaction -- allows a procedure to communicate with an object on the current form.
- 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).
- 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.
- partialdatabaseupdate -- updates one or more components of an existing database.
- playsound -- starts playing a sound file.
- posixtask -- executes a POSIX shell script in the background using NSTask.
- printonemultiple -- prints a form over and over again without advancing from record to record. Instead of advancing from record to record, a variable is incremented each time the form is printed. This statement is designed for printing calendars or thumbnails.
- printtopdf -- prints the current database to a PDF file.
- printusingform -- allows the current database to be printed using a different form than the one currently being displayed.
- procedureexists( -- checks to see whether a procedure exists or not.
- procedureinsertfieldname -- inserts a field name into a procedure, adding chevrons if necessary.
- procedureinsertformname -- inserts a form name into a procedure, adding quotes.
- procedureinsertprocedurename -- inserts a procedure name into a procedure, adding quotes if necessary.
- proceduresearch -- searches for text in a procedure.
- proceduresearchexact -- searches for text in a procedure.
- proceduresearchnext -- searches for text in a procedure, starting from the current location.
- proceduresearchnextexact -- searches for text in a procedure, starting from the current location.
- Program Menu -- assists with running and debugging code, and with developing custom dialogs.
- Programming -- basics of programming with Panorama X.
- recompile -- recompiles all procedures in a database.
- rememberwindow -- remembers the currently active window, so that you can get back to it later.
- saveallprocedures -- saves all the procedures in the specified database into a dictionary.
- saveoneprocedure -- saves a specific procedure in the specified database into a dictionary.
- saveopenprocedures -- saves all the open procedures in the specified database into a dictionary.
- savepartialdatabase -- saves specified components of the current database, leaving other components out.
- serverupdate -- temporarily disables record locking and server updates when using a shared database.
- setactivedatabase -- makes a database active (without changing the configuration of the windows).
- setprocedureoptions -- modifies one or more properties of a procedure (source code, Action menu options, etc.).
- setproceduretext -- changes the text of the currently open procedure.
- 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.
- Source Menu -- used to assist in editing program code.
- startbonjour -- starts monitoring the local network for available hosts.
- startfilesystemmonitor -- sets up and starts a repeating task that will be performed whenever a file and/or folder is modified.
- starttimer -- sets up and starts a repeating task that will be performed periodically when Panorama is not otherwise busy.
- stopbonjour -- cancels monitoring of the local network for available hosts.
- stopfilesystemmonitor -- stops a repeating task that has been set up to be performed whenever a file and/or folder is modified.
- stopposixtask -- stops a POSIX shell script that is running in the background.
- Text Display Programming -- programming a Text Display Object.
- Text Editor Programming -- programming a Text Editor Object.
- 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.
- Window ID Numbers -- ID numbers for identifying windows.
- 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
10.2 | Updated | New option "Variables" allows windowglobal variables to be set up just before the window actually opens. New option "NoVersionButton". |
10.0 | Updated | Carried 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. |