Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter SeventeenApplication Integration Functions (continued)

MenuAddFunction Function

Overview

The MenuAddFunction function will add an item to the application’s registered functions.

Syntax/Parameters

Syntax

int = MenuAddFunction ( string[] parameters );

int = MenuAddFunction ( string code, string menu, string description );

Parameters

parameters

A string array specifying one or more parameters. At a minimum, the array must contain a key named ‘Code’. See remarks for key names. If this mode is used, then no other parameters can be provided.

code

A string containing the specific code for a function (for example, “EDGAR_SUBMIT_TEST”). When a code is employed, the menu item is assumed to belong to the “Extensions” group as part of the File | Extensions | Tool popup menu. This parameter has a maximum of 64 characters. The following parameters must also be present.

menu

A string that specifies the text for the menu item. A highlight key can be added to a letter by preceding it with an ‘&‘ character. This parameter has a maximum of 64 characters.

description

A string containing the description for the item. This parameter has a maximum of 512 characters. This is displayed on the status bar or popup tip.

Return Value

Returns an int containing the function ID or -1 on failure. Use the GetLastError to retrieve a formatted error code. Additional information can be retrieved using the GetLastErrorMessage function.

Remarks

Generally, all extension Function IDs start at a base of 17,002 and continue to 17,500. When the array is employed as an input parameter to the MenuAddFunction function, the following key names can be used:

  Code Function Code — A required unique code that identifies the function (maximum of 48 characters).  
  State Enabled State — A code that helps the ribbon and menu managers determine the state of the function (maximum of 8 characters).  
  Class Class for Function — This is used to group functions. By default, the value will be ‘Extension’ which will force the function to be automatically added to the tools popup on the file ribbon.  
  MenuText Text to Display in Menu — The text used to display a menu item in a popup or drop down (maximum of 64 characters). The ‘&‘ character can be used to keyboard access and underline display.  
  RibbonText Text to Display on Ribbon — The text used to display as a ribbon item (maximum of 64 characters).  
  ShortDescription Short Description — Short description used for dialogs and certain menus. If omitted, a short description is automatically generated (maximum of 48 characters).  
  Description Long Description — Description used for popup tips and the status bar. The description can contain simple HTML inline such as <B> or <I>. In addition, return characters can be used to format text within a tool tip (maximum of 512 characters).  
  InternalBitmap Bitmap Name — Bitmap name for an internal existing menu function for use to display an associated icon. This cannot point to a script defined bitmap.  
  SmallBitmap Small Bitmap Name — The name of a resource defined within the script or a bitmap file. This bitmap must be 22x22 pixels or less for display as small ribbon or menu items.  
  LargeBitmap Small Bitmap Name — The name of a resource defined within the script or a bitmap file. This bitmap must be 40x35 (width/height) pixels or less for display as large ribbon items.  

 

Any additional array items are ignored by the function.

Bitmaps can be added to functions either by referencing an existing internal bitmap or supplying a resource. The can be a local resource defined by the BITMAP resource name or by directly referencing a file. See Section 9.8 Image Resources for additional information on defining image resources. When a script resource or file is loaded, the internal handle for the item is not released until the function is deleted or the application terminates. References to the data are not shared and therefore reloaded on each call to MenuAddFunction. Use the of SmallBitmap or LargeBitmap key name parameters automatically overrides the InternalBitmap parameter.

For display purposes, the upper left pixel (0,0) defines the transparent color for bitmaps.

The “Class” key name has special meaning for certain popup menus:

  DataExtension Item will appear on the Spreadsheet | Extensions | Tools popup.  
  DocumentExtension Item will appear on the Document | Extensions | Tools popup.  
  EditExtension Item will appear on the Edit | Extensions | Tools popup.  
  Extension Default, item will appear in the File | Extensions | Tools popup.  
  FormsViewExtension Item will appear on the Data | Extensions | Tools popup.  
  HTMLFormExtension Item will appear on the Object | Extensions | Tools popup.  
  ParagraphExtension Item will appear on the Paragraph | Extensions | Tools popup.  
  PreferencesExtension Item will appear on the File | Preferences popup.  
  PublishExtension Item will appear in the File | Send | Publish popup.  
  ScriptExtension Item will appear on the Script | Extensions | Tools popup.  
  TableExtension Item will appear on the Table | Extensions | Tools popup.  
  TextExtension Item will appear on the Text | Extensions | Tools popup.  

 

For EDGAR products, additional “Class” keys are available depending on the product:

  EDGARExtension Item will appear on the Submission | Extensions | Tools popup.  
  Form13FExtension Item will appear on the Submission | Extensions | Tools popup.  
  Form13HExtension Item will appear on the Submission | Extensions | Tools popup.  
  Form17AExtension Item will appear on the Submission | Extensions | Tools popup.  
  Form17HExtension Item will appear on the Submission | Extensions | Tools popup.  
  FormCExtension Item will appear on the Submission | Extensions | Tools popup.  
  FormCFPExtension Item will appear on the Submission | Extensions | Tools popup.  
  FormDExtension Item will appear on the Submission | Extensions | Tools popup. and on the Form D ribbon as well.  
  FormMAExtension Item will appear on the Submission | Extensions | Tools popup.  
  FormNMFPExtension Item will appear on the Submission | Extensions | Tools popup and on the Form N-MFP ribbon as well..  
  FormNSARFExtension Item will appear on the Submission | Extensions | Tools popup.  
  FormSDRFExtension Item will appear on the Submission | Extensions | Tools popup.  
  FormTAExtension Item will appear on the Submission | Extensions | Tools popup.  
  iXBRLExtension Item will appear on the iXBRL | Extensions | Tools popup.  
  RegulationAExtension Item will appear on the Submission | Extensions | Tools popup.  
  Section16Extension Item will appear on the Submission | Extensions | Tools popup.  
  XBRLExtension Item will appear on the XBRL Extensions | XBRL Report | Tools popup.  
  XDXMarkupExtension Item will appear on the XDX Markup | Extensions | Tools popup.  
  XDXReportExtension Item will appear on the XDX Report | Extensions | Tools popup.  

 

Development Notes

While developing a script and adding menu items, be advised that once a menu item has been added it will persist throughout the development session until the application is closed or the function has been deleted. As such, making changes to code surrounding adding a menu item will appear to not have an impact.

Hooks

It is up to the script to hook the menu code to a specific function. Hooked items will only receive a preprocess notification since the application function dispatch will return an ERROR_FUNCTION_NOT_SUPPORTED error and then exit prior to the post process hook.

Related Functions 

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic

Page revised 2024-10-21