Calling Sequence Entries[Add](nm, action, t, opts)

Parameters

 nm - string; text that appears in context menu action - string or procedure; command applied to object when this entry is selected, or procedure that returns the command t - type; type that the clicked object must match for entry to appear, can also be exprseq for a sequence opts - (optional) equation(s) of the form option=value, where option is one of 'active', 'autoassign', 'category', 'entry_generator', 'helpstring', 'operator', 'submenu', or 'test'; specify additional information for the entry

Description

 • The Entries[Add] command adds an entry to the context menu module. An entry is a selectable item that appears in a context menu. Whether or not an entry appears in a particular menu depends on the properties of the selected object.
 • The parameter nm is the text that appears in the context menu for this entry.
 • The action parameter is the command that is applied to the right-clicked object if the entry is selected. It is specified as a string, which contains a Maple command that is applied to the object. Within this string, the name %EXPR may be used to refer to the right-clicked object. If the entry uses an entry generator (see EntryGenerators), then the names, %ARG1, %ARG2, ...,  may be used to refer to the values returned by the generated submenu entries.
 • The parameter t is the type to which the entry applies. It must be either a valid Maple type or the name exprseq. The entry will not be displayed in the context menu unless the selected object is of type t. If exprseq is specified, the selected object must be NULL or an expression sequence of 2 or more elements for the entry to be displayed. Note that only maple types that do not execute inline code are supported from within the context menu (e.g. type,satisfies is not supported).

Optional Parameters

 The opts arguments may be one or more of the following equations.
 'active' = true, false, or string
 Determines whether the entry should appear in the context menu.  Disabling an entry with the Disable command is equivalent to setting the 'active' option to false. If specified as a string, then this refers to a boolean-valued query that takes no input arguments (for more information on queries, see Queries). Generally 'active' queries are used to specify whether a menu entry should be visible based upon which packages are currently loaded. If omitted, this option defaults to true.
 'autoassign' = true or false
 Determines whether the result of the action that appears in the worksheet (Classic Worksheet interface only) should be automatically assigned to an automatically-generated variable.
 'category' = string
 Set the category to which this menu entry should belong.  This is only applicable when option submenu is not supplied.  The call category=cname is equivalent to the command Categories[Set](Name, cname). For more information on categories, see the Categories help page.
 'entry_generator' = string
 This option should refer to the name of an existing entry generator. It is responsible for the menu entries that appear in a submenu of the entry being added.  For more information on entry generators, see the EntryGenerators help page.
 'helpstring' = string
 The text that the user sees when the mouse cursor is positioned above this entry in a context menu while either using the Classic worksheet, or using the Standard worksheet with menu tips enabled.
 'operator' = TypeMK
 Specifies what 2D math transition should appear when working in document mode and performing context menu entries in-line. The default value for this option is Typesetting:-mo("→") which is displayed as a right arrow $\to$. When customizing this it is recommended to use the template Typesetting:-mover(Typesetting:-mo("oper"),Typesetting:-mtext("text")) Where oper should be an operator symbol, like → or =, and text should be a text description like transpose. Most MathML operator symbols are supported as a choice for oper. For example, setting operator to Typesetting:-mover(Typesetting:-mo("⇒"),Typesetting:-mtext("implies")) displays as $\stackrel{\text{implies}}{⇒}$.
 'test' = function or string
 Specifies an additional test that the right-clicked object must satisfy for the entry to appear in the context menu.  The test may be a string, which must be name of boolean-valued query (for more information on queries, see Queries).  It may also take the form And(test1, ..., testn), Or(test1, ..., testn), or Not(test1), where testi is itself a test.  In this way complex logical expressions of tests can be formed.

 Add an entry to the context menu that negates a boolean value.
 > Entries[Add](   "Negate",   "not %EXPR",   boolean,   'helpstring'="Negate the expression"):
 Add an entry to the context menu that generates 3-D plots from an expression sequence.
 > Entries[Add](   "3-D Plot",   "smartplot3d([ %EXPR ])",   exprseq,   'submenu'=["Plots"],   'autoassign'=false,   'helpstring'="Generate 3-D plots"):
 Add an entry to the context menu that differentiates the input expression by one of the variables contained in the expression.
 > EntryGenerators[Add]("ChooseVariable", proc(e)     local L;     L := convert(indets(e, 'name'), 'list');     [seq(["Variable "||i, [i]], i=1..nops(L))] end proc):
 > Entries[Add](   "Differentiate",   "diff(%EXPR, [%ARG1])",   algebraic,   'entry_generator'="ChooseVariable"):
 Add an entry to the context menu that sorts a list in ascending order.
 > Entries[Add](   "Ascending Order",   "sort( %EXPR, '<' )",   list('numeric'),   'submenu'=["Sorts"],   'helpstring'="Sort the list in ascending order"):