add entry to the context menu module
Examples of Entries[Add]
Entries[Add](nm, action, t, opts)
string; text that appears in context menu
string or procedure; command applied to object when this entry is selected, or procedure that returns the command
type; type that the clicked object must match for entry to appear, can also be exprseq for a sequence
(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
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 selected 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 selected 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).
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 →. 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 ⇒implies.
'test' = function or string
Specifies an additional test that the selected 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 test 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.
'helpstring'="Negate the expression"):
Add an entry to the context menu that generates 3-D plots from an expression sequence.
"smartplot3d([ %EXPR ])",
'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.
L := convert(indets(e, 'name'), 'list');
[seq(["Variable "||i, [i]], i=1..nops(L))]
Add an entry to the context menu that sorts a list in ascending order.
"sort( %EXPR, '`<`' )",
'helpstring'="Sort the list in ascending order"):
Creating Custom Context-sensitive Menu Entries
Download Help Document
What kind of issue would you like to report? (Optional)