getprocedureoption(
DATABASE
,
PROCEDURE
,
OPTION
)

The getprocedureoption( function returns information about a procedure.


Parameters

This function has three parameters:

database – The database that contains the procedure you want information about, or "" for the current database.

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

option – The type of information you want to retrieve. See below for descriptions of each option. This parameter is optional, if left off the ALL option will be used.


Description

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

ALL

This option returns a dictionary that contains all of the option values associated with this procedure. You can extract individual options with the getdictionaryvalue( function. (You can also get this dictionary by simply omitting the option parameter.) This example displays information about a procedure’s syntax error (if it has one).

local pinfo
pinfo = getprocedureoption("","SomeProcedure")
if getdictionaryvalue(pinfo,"ERROR") <> ""
    message "Error in procedure "+getdictionaryvalue(pinfo,"NAME")+cr()+cr()+
        getdictionaryvalue(pinfo,"ERROR")+cr()+
        "CODE:"+getdictionaryvalue(pinfo,"SOURCE")[getdictionaryvalue(pinfo,"ERRORSTART"),
                                                   getdictionaryvalue(pinfo,"ERROREND")]
endif

SOURCE

This option returns the source code of the specified procedure. This example uses this option to create a list of procedures in the current database that contain the word message.

local proclist
proclist = dbinfo("procedures","")
proclist = arraystrip(arrayfilter(proclist,cr(),
    {?(getprocedureoption("",import(),"SOURCE") contains "message",import(),"")}),cr())
message proclist

ERROR

This option checks to see if the procedure has a syntax (compile time) error, and if so, reports the error. If there is no error, "" is returned. This example returns a list of the procedures in the current database that contain an error.

local proclist
proclist = dbinfo("procedures","")
proclist = arraystrip(arrayfilter(proclist,cr(),
    {?(getprocedureoption("",import(),"ERROR") <>"",import()+
        ":"+getprocedureoption("",import(),"ERROR"),"")}),cr())
message proclist

The output of this procedure will be something like this:

AddInvoice:Unknown statement:totals
VoidInvoice:Missing Right Parenthesis

ERRORSTART

If the specified procedure contains an error, this option will return the starting position of the error within the source code.

ERROREND

If the specified procedure contains an error, this option will return the ending position of the error within the source code.

LABELS

This option returns a carriage return delimited list of labels defined in the specified procedure (if any).

POSITION and SIZE

The “windowleftedge”, “windowtopedge”, “windowrightedge” and “windowbottomedge” options return the saved dimensions of the procedure window (whether it is currently open or not). The “windowrectangle” function returns a rectangle with all four coordinates.

TAG

This option returns the tag you have assigned 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.


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

This option returns the color the Action menu item associated with the specified procedure.

colorHue = hue(getprocedureoption("","FedEx","MENUCOLOR"))

See Colors for more information about using colors with Panorama.

This option checks whether the Action menu item associated with this procedure is disabled (dim).

RushAvailable = getprocedureoption("","Rush","MENUDISABLED") = false()

Panorama normally has special treatment for procedure names that start with the ( symbol, but this special treatment can be turned off on a menu item by item basis. This option checks to see whether the special ( treatment is enabled or not.

getprocedureoption("","(213) 555=1212","MENUDISPLAYLEADINGPARENTHESES")

This option returns the font assigned to the Action menu item associated with the specified procedure.

if getprocedureoption("","People","MENUFONT") = "Marker Felt"
    message "Really?"
endif

Note: If the item uses the system menu font this function will return "".

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

if getprocedureoption("","Big Big People","MENUFONTSIZE") > 24
    message "Wow, that's big!"
endif

This option returns the indent level of the Action menu item associated with this procedure.

This option returns true if the specified procedure is invisible (not included in the Action menu). Note: This option does not return true for procedures with names beginning with a period, or procedures following a () procedure, even though those are also invisible.

This option returns the command key equivalent, if any, for the Action menu item associated with this procedure.

if getprocedureoption("",someProcedure,"MENUKEY") <> ""
    message "This item has a command key equivalent"
endif

This option returns any modifier keys for the command key equivalent associated with this procedure. The available modifier keys are "SHIFT", "OPTION" and "CONTROL". You can use these options separately or in combination.

if getprocedureoption("","Color","MENUKEYMODIFIERS","shift") contains "OPTION"

This option returns whether or not the Action menu item associated with the procedure has a checkmark.

if getprocedureoption("","Shipped","MENUSTATE") = "ON" // checked
    // shipped
    ...
endif
if getprocedureoption("","Shipped","MENUSTATE") = "" // not checked
    // not shipped
    ...
endif
if getprocedureoption("","Shipped","MENUSTATE") = "MIXED" // dash
    // partially shipped
    ...
endif

This option returns the style used by the Action menu item associated with the specified procedure.

if getprocedureoption("","People","MENUSTATE") contains "italic"
    ...
endif
if getprocedureoption("","People","MENUSTATE") = ""
    // plain text
    ...
endif

See Also


History

VersionStatusNotes
10.0NewThis function is new in this version.