setprocedureoptions
setprocedureoptions
DATABASE
,
PROCEDURE
,
OPTION
,
VALUE

The setprocedureoptions statement modifies one or more properties of a procedure (source code, Action menu options, etc.).

Parameters

This statement has four parameters:

database – The database that contains the procedure you want to modify, or `""` for the currently active database. The database must be open.

procedure – The name of the procedure you want to modify, or `""` for the currently open procedure (if a procedure editor window is active).

option – The type of information you want to modify. See below for descriptions of each option. The option can be specified in either upper or lower case.

value – The new value for this option.

Description

This function modifies information about any procedure in any open database.

Note: You can specify multiple option/value pairs in a single setprocedureoptions statement, like this:

    setprocedureoptions dataabase,procedure,option1,value1,option2,value2,option3,value3

#### SOURCE

This option modifies the source code of the specified procedure. If the procedure is currently open you’ll see the the change immediately. This example creates a new procedure called Aloha.

    makenewprocedure "Aloha"
    setprocedureoptions "","Aloha","SOURCE",{message "Aloha"}

The new procedure is ready to use.

Note: If the source code you specify is invalid (contains a syntax error, unknown statement, etc.) then the procedure will stop with an error. (Of course you can trap this error with if error, etc.)

#### NAME

This option changes the name of the specified procedure. This example changes the name of the procedure Aloha to Hello.

    setprocedureoptions "","Aloha","NAME","Hello"

The database must not already contain a procedure with the new name. If it does, the setprocedureoption statement will stop with an error.

#### POSITION

This option moves the procedure to a new position in the list of procedures. This is primarily useful for changing the order in which procedures appear in the Action Menu.

This example moves the Add Invoice procedure so that it appears before the Delete Invoice procedure.

    setprocedureoptions "","Add Invoice","POSITION","Delete Invoice"

Use `""` to move a procedure to the end of the list, like this:

    setprocedureoptions "","Display Contact","POSITION",""

#### DELETE

This option deletes the specified procedure.

    setprocedureoptions "","Destroy Universe","DELETE",""

Notice that even though the option value is not used, you must still supply it.

#### EXCLUDEFROMVIEWMENU

If this option is false, the procedure is displayed in the View menu. If this option is true, the procedure will be excluded from the View menu.

#### TAG

This option assigns a tag to this procedure (if any). You can use the tag value for whatever you want, Panorama stores the tag for you but does not use or interpret it in any way.

### Menu Options ###

The following options modify the appearance and operation of the Action menu item associated with the specified procedure.

#### MENUCOLOR

Action menu items are normally black, but can be changed to any color using this item. The color can be specified using rgb(, hsb( or other color functions (see Colors), or simply by specifying text containing an HTML color.

    setprocedureoptions "","Red","MENUCOLOR",rgb( 65535 , 0 , 0 )
    setprocedureoptions "","Red","MENUCOLOR","FF0000"

#### MENUDISABLED

This option specifies that the Action menu item associated with this procedure should be disabled (dim).

    setprocedureoptions "","Destroy Universe","MENUDISABLED",true() // don't allow this option!
    setprocedureoption "","Destroy Universe","MENUDISABLED","Yes" // other alternatives are "True" and "On"

#### MENUDISPLAYLEADINGPARENTHESES

Panorama normally has special treatment for procedure names that start with the ( symbol. This option tells Panorama to skip the special treatment (but for this procedure only) and display the procedure name as-is, including the leading ( symbol.

    setprocedureoptions "","(213) 555=1212","MENUDISPLAYLEADINGPARENTHESES",true()

#### MENUFONT

This option specifies a custom font for the Action menu item associated with the specified procedure.

    setprocedureoptions "","People","MENUFONT","Papyrus"

You can use this option on its own or in combination with the MENUFONTSIZE and MENUSTYLE options.

    setprocedureoptions "","Run","MENUFONT","Optima","MENUSTYLE","ITALIC"

#### MENUFONTSIZE

This option specifies a custom font size for the Action menu item associated with the specified procedure. The size is specified in points.

    setprocedureoptions "","Big Big People","MENUFONTSIZE",36

You can use this option on its own or in combination with the MENUFONT and MENUSTYLE options.

    setprocedureoption "","Run","MENUFONT","Helvetica","MENUFONTSIZE",7

#### MENUINDENT

This option indents the procedure name in the Action menu. You could achieve the same effect by adding spaces to the front of the procedure name, but this option allows the same effect without changing the name (which means that call statements to this procedure will not be broken). This example shows how to indent various shipping options under a main Shipping menu item.

    setprocedureoptions "","Shipping","MENUINDENT",0
    setprocedureoptions "","FedEx","MENUINDENT",1
    setprocedureoptions "","US Mail","MENUINDENT",1
    setprocedureoptions "","UPS","MENUINDENT",1

#### MENUINVISIBLE

This option specifies that this procedure should not be included in the Action menu. (Note: Procedures with names beginning with period, or following a () procedure, will also be invisible.)

    setprocedureoptions "","Reset","MENUINVISIBLE",true() // user can't even see this option!

#### MENUKEY

This option specifies the command key equivalent, if any, for the Action menu item associated with this procedure. If an alphabetic character is used, it should be lower case unless you want the SHIFT key to be part of the key equivalent.

    setprocedureoptions "","Create Universe","MENUKEY","u" // Command-U
    setprocedureoptions "","Create Universe","MENUKEY","U" // Command-Shift-U

Note: If the command key equivalent you specify conflicts with one of Panorama’s built-in menu items, your key equivalent will not appear. If you notice that your command key equivalent is not working, carefully check all of Panorama’s built-in menus and you’ll probably find that there is a conflict.

Note: See the MENUKEYMODIFIERS option for an alternative method to specify the SHIFT key as part of the command key equivalent.

#### MENUKEYMODIFIERS

This option specifies any modifier keys for the command key equivalent specified by the MENUKEY option. The available modifier keys are `"SHIFT"`, `"OPTION"` and `"CONTROL"`. You can use these options separately or in combination.

    setprocedureoptions "","Color","MENUKEY","y,"MENUKEYMODIFIERS","shift" // ⌘-Shift-Y
    setprocedureoptions "","Color","MENUKEY","y,"MENUKEYMODIFIERS","shift option" // ⌘-Shift-Option-Y
    setprocedureoptions "","Color","MENUKEY","y,"MENUKEYMODIFIERS","shiftoption" // ⌘-Shift-Option-Y

Note: You can also use the `"NOCOMMAND"` option to specify a key equivalent without the command key. Be very careful when doing this, however, since they combination you specify will no longer be available for regular typing.

#### MENUSTATE

This option allows you to add a checkmark to the Action menu item associated with the procedure.

    setprocedureoptions "","Shipped","MENUSTATE",true() // show checkmark
    setprocedureoptions "","Shipped","MENUSTATE","on" // or "yes" or "true"
    setprocedureoptions "","Shipped","MENUSTATE",false() // don't show checkmark
    setprocedureoptions "","Shipped","MENUSTATE","off" // or "no" or "false"

You can also specify a mixed state, both on and off. This is displayed as a minus sign (dash) just to the left of the procedure name in the menu. For example, this could be used to indicate a partially shipped order.

    setprocedureoptions "","Shipped","MENUSTATE","mixed" // show dash
    setprocedureoptions "","Shipped","MENUSTATE","on off" // show dash
    setprocedureoptions "","Shipped","MENUSTATE","onoff" // or "yesno", "truefalse", "offon" etc.

#### MENUSTYLE

This option specifies a style for the Action menu item associated with the specified procedure.

    setprocedureoptions "","People","MENUSTYLE","italic"
    setprocedureoptions "","People","MENUSTYLE","bold"
    setprocedureoptions "","People","MENUSTYLE","bold italic"

In the last example, the space is optional, and you can specify the styles in any order.

You can use this option on its own or in combination with the MENUFONTSIZE and MENUSTYLE options.

    setprocedureoptions "","Run","MENUFONT","Optima","MENUSTYLE","ITALIC"

Note: Not all fonts support bold and/or italic styles. If the style doesn’t appear, check to make sure that the fonts supports the requested style. (Note: The standard system menu font does not support italic. However, if you are using the standard system menu font Panorama will automatically switch to Helvetica if the menu item has an italic style.)

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.
- closedatabaseactiveobjects -- stops all text editing associated with the current database.
- controlsound -- controls playback of a sound file.
- 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.
- 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.
- 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("proceduredatabase") -- returns the name of the database that contains the currently running procedure.
- info("procedurename") -- returns the name of the currently running procedure.
- join -- joins data from another database into the current database.
- joinonerecord -- joins matching data from another database into the current record.
- loadallprocedures -- loads all the procedures from a dictionary into the current database. If a procedure doesn't exist it will be created.
- makenewform -- creates a new form in the current database.
- makenewprocedure -- creates a new procedure in the current database.
- 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.
- 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.
- 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.
- 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.).
- 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.
- windowbox -- specifies the dimensions (size and location) of the next window that is opened (with openform, opensheet, openprocedure etc.).

History

Version | Status | Notes
10.2 | New | New option excludefromviewmenu.
10.0 | New | This statement is new in this version.