standardfilemenu()

The standardfilemenu( function generates a customizable Custom Menu specification for Panorama’s standard File menu.


Parameters

No parameters.


Description

This function generates a customizable Custom Menu specification for Panorama’s standard File menu in Panorama’s Live Menu Specification Language (LMSL). Use this when you want to include Panorama’s standard File menu as part of your custom menu:

standardfilemenu()+
standardeditmenu()+
menu("My Custom Menu")+
    menuitem("Do something")+
    menuitem("Do another thing")+
    menuitem("Do something else")

Customizing the Menu

Sometimes you may not want to use the standard File menu as-is, but rather want to customize it by adding your own menu items, or perhaps replacing or removing some existing standard menu items while leaving others alone. The standardfilemenu( function includes a built-in version of the arrayhack( function that makes this easy to do. Simply add one or more pairs of search/hack parameters to specify the changes you want to make (see the arrayhack( function for an explanation of these parameters).

To understand how this works, start by looking at the default output of the standardfilemenu( function, shown below (you should check this output yourself in case the output has changed since this documentation was written):

(File)
    New [newDocument:]/N
    Open... [openDocument:]/O
    Open Recent (_OriginalOpenRecent)
    (-
    Close   [performClose:]/W
    (-
    Save... [saveDocument:]$_OriginalSaveDocument;/S
    (-
    Page Setup...   [runPageLayout:]/?P
    Print...    [print:]/P

The first step in customizing the menu is to identify where you want to modify the menu. Usually the best way to do this is via the menu items action, this is the portion in brackets, for example [newDocument:] or [performClose:]. The action will always be the same even if the menu is translated into another language. You can find out all of the menu item actions by looking at the output of the standardfilemenu( function.

To add a new menu item below a current menu item you need to add two parameters to the standardfilemenu( function. The first parameter specifies the existing menu item above where you want the new item inserted, while the second specifies the actual new menu item. This example inserts a new menu item, Open Contacts, just below the openDocument: menu item.

standardfilemenu("[openDocument:]",menuitem("Open Contacts","RUN",{opendatabase "Contacts"}))

You can insert more than one menu item if you want. This example inserts three menu items below the Open menu item.

standardfilemenu("[openDocument:]",
    menuitem("Open Contacts","RUN",{opendatabase "Contacts"})+
    menuitem("Open Invoices","RUN",{opendatabase "Invoices"})+
    menuitem("Open Inventory","RUN",{opendatabase "Inventory"}))

If you wish, an entire submenu can be inserted. This is similar to the previous example, but instead of three menu items in the File menu itself, an Open Related submenu (inserted below the Open menu item) lists the three related databases.

submenu("Databases")+
    menuitem("Contacts","RUN",{opendatabase "Contacts"})+
    menuitem("Invoices","RUN",{opendatabase "Invoices"})+
    menuitem("Inventory","RUN",{opendatabase "Inventory"})+
standardfilemenu("[openDocument:]",menuitem("Open Related","SUBMENU","Databases"))

To insert a new menu item (or items) above an existing menu item, append a ∆ (Option-J) character in front of the new menu item. This example inserts three menu items above the Close menu item: Process, Filter, and a separator line.

standardfilemenu("[performClose:]","∆"+
    menuitem("Process")+
    menuitem("Filter")+
    menuseparator()+

To replace an existing menu item, append a = symbol in front of the new menu text. This example modifies the New menu item so that it no longer responds to the Command-N key equivalent.

standardfilemenu("[newDocument:]","="+menuitem("New","Action","newDocument:"))

To remove an existing menu item, set the hack parameter to empty text (""). This example removes the New menu item.

standardfilemenu("[newDocument:]","")

All of the examples so far have shown only a single search/hack pair, but you can include as many as you need. This example removes both the New and Close menu items.

standardfilemenu("[newDocument:]","","[performClose:]","")

This example removes the New menu item and adds three new menu items below the Open menu item.

standardfilemenu(
    "[newDocument:]","",
    "[openDocument:]",
        menuitem("Open Contacts","RUN",{opendatabase "Contacts"})+
        menuitem("Open Invoices","RUN",{opendatabase "Invoices"})+
        menuitem("Open Inventory","RUN",{opendatabase "Inventory"}))

See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0, but now allows the returned menu specification to be customized.