ContextMenu[Test] - Maple Programming Help

 get generated submenu entries and actions

Parameters

 expr - anything; expression to test submenu - list; list containing the name of the submenu to retrieve

Description

 • The Test[GetGeneratedSubmenuAndAction] command returns a representation of the context-sensitive submenu and each respective applied action that would be generated by the expression expr.

Examples

 > $\mathrm{with}\left(\mathrm{ContextMenu}\right):$
 > $\mathrm{with}\left(\mathrm{ContextMenu}\left[\mathrm{Test}\right]\right):$

The GetGeneratedMenuAndAction command returns the entire generated context menu and the respective applied actions for a given expression:

 > $\mathrm{GetGeneratedMenuAndAction}\left(1\right)$
 $\left[\left[{"Apply a Command"}{,}{"x -> ContextMenu:-Interactive:-Apply\left(op\left(x\right)\right)"}\right]{,}\left[{"Assign to a Name"}{,}{"x -> ContextMenu:-Interactive:-Assign\left(op\left(x\right)\right)"}\right]{,}\left[{"Divisors"}{,}{"NumberTheory:-Divisors\left(%EXPR\right)"}\right]{,}\left[{"Expand"}{,}{"expand\left( %EXPR \right)"}\right]{,}\left[{"Integer Factors"}{,}{"ifactor\left(%EXPR\right)"}\right]{,}\left[{"Plots"}{,}\left[\left[{"Plot Builder"}{,}{"x -> InteractivePlotBuilder:-BuildPlot\left(op\left(x\right),\left(\text{'}contextmenu\text{'}\right) = true\right)"}\right]\right]\right]{,}\left[{"Prime Factors"}{,}{"NumberTheory:-PrimeFactors\left(%EXPR\right)"}\right]{,}\left[{"Sum of Squares"}{,}{"NumberTheory:-SumOfSquares\left(%EXPR\right)"}\right]{,}\left[{"Totient Function"}{,}{"NumberTheory:-Totient\left(%EXPR\right)"}\right]{,}{"|"}{,}\left[{"Integer Functions"}{,}\left[\left[{"Integer Base 10 Log"}{,}{"ilog10\left( %EXPR \right)"}\right]{,}\left[{"Integer Base 2 Log"}{,}{"ilog2\left( %EXPR \right)"}\right]{,}\left[{"Integer Natural Log"}{,}{"ilog\left( %EXPR \right)"}\right]\right]\right]{,}\left[{"Queries"}{,}\left[\left[{"Is Mersenne Number?"}{,}{"NumberTheory:-IsMersenne\left(%EXPR\right)"}\right]{,}\left[{"Is Perfect Square?"}{,}{"issqr\left(%EXPR\right)"}\right]{,}\left[{"Is Prime Number?"}{,}{"isprime\left(%EXPR\right)"}\right]{,}\left[{"Is Square Free?"}{,}{"NumberTheory:-IsSquareFree\left(%EXPR\right)"}\right]\right]\right]{,}\left[{"Units"}{,}\left[\left[{"Affix Unit"}{,}\left[\left[{"Atomic"}{,}\left[\left[{"bohr"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron mass"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron per second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron*bohr"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron*bohr^2/volt"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron/bohr^2"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron^2/hartree"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron_mass*bohr/second^2"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"hartree"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"hartree per second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"hartree/bohr"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"hartree/tesla"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"hartree/tesla*bohr^3"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"hartree/tesla^2"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"permittivity"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"planck"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"tesla"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"volt"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"volt*second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"volt*second^2/electron"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"volt/bohr"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]\right]\right]{,}\left[{"CGS"}{,}\left[\left[{"barye"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"centimeter"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"dyne"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"erg"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"erg/second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"g"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"gram"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"kyne"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"radian"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"steradian"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]\right]\right]{,}\left[{"EMU"}{,}\left[\left[{"abampere"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"abcoulomb"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"abfarad"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"abhenry"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"abohm"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"absiemens"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"abtesla"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"abvolt"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"abweber"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"barye"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"centimeter"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"dyne"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"erg"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"erg/second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"g"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"gram"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"joule"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"kilogram"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"kyne"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"meter"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"newton"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"pascal"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"radian"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"steradian"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"watt"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]\right]\right]{,}\left[{"FPS"}{,}\left[\left[{"foot"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"horsepower"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"pound"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"poundal"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"poundal*foot"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"poundforce/inch^2"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"radian"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"steradian"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]\right]\right]{,}\left[{"MTS"}{,}\left[\left[{"kilojoule"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"kilowatt"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"meter"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"pieze"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"radian"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"steradian"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"sthene"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"tonne"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]\right]\right]{,}\left[{"SI"}{,}\left[\left[{"coulomb"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"farad"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"henry"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"joule"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"kilogram"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"lumen"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"lux"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"meter"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"newton"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"ohm"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"pascal"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"radian"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"siemens"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"steradian"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"tesla"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"volt"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"watt"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"weber"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]\right]\right]\right]\right]\right]\right]{,}{"|"}{,}\left[{"Combinations/Permutations"}{,}\left[\left[{"Combinations"}{,}\left[\left[{"Count"}{,}{"combinat:-numbcomb\left(%EXPR\right)"}\right]{,}\left[{"Generate"}{,}{"combinat:-choose\left(%EXPR\right)"}\right]\right]\right]{,}\left[{"Fibonacci"}{,}{"combinat:-fibonacci\left(%EXPR\right)"}\right]{,}\left[{"Partitions"}{,}\left[\left[{"Count"}{,}{"combinat:-numbpart\left(%EXPR\right)"}\right]{,}\left[{"Generate"}{,}{"combinat:-partition\left(%EXPR\right)"}\right]{,}\left[{"Random"}{,}{"combinat:-randpart\left(%EXPR\right)"}\right]\right]\right]{,}\left[{"Permutations"}{,}\left[\left[{"Count"}{,}{"combinat:-numbperm\left(%EXPR\right)"}\right]{,}\left[{"Generate"}{,}{"combinat:-permute\left(%EXPR\right)"}\right]{,}\left[{"Random"}{,}{"combinat:-randperm\left(%EXPR\right)"}\right]\right]\right]{,}\left[{"Power Set"}{,}{"combinat:-powerset\left(%EXPR\right)"}\right]\right]\right]{,}\left[{"Number Theory Functions"}{,}\left[\left[{"Calkin-Wilf Sequence"}{,}{"NumberTheory:-CalkinWilfSequence\left(%EXPR\right)"}\right]{,}\left[{"Carmichael Function"}{,}{"NumberTheory:-CarmichaelLambda\left(%EXPR\right)"}\right]{,}\left[{"I-th Prime"}{,}{"ithprime\left(%EXPR\right)"}\right]{,}\left[{"Imaginary Unit"}{,}{"NumberTheory:-ImaginaryUnit\left(%EXPR\right)"}\right]{,}\left[{"Inverse Totient Function"}{,}{"NumberTheory:-InverseTotient\left(%EXPR\right)"}\right]{,}\left[{"Moebius Function"}{,}{"NumberTheory:-Moebius\left(%EXPR\right)"}\right]{,}\left[{"Next Prime"}{,}{"nextprime\left(%EXPR\right)"}\right]{,}\left[{"Next Safe Prime"}{,}{"NumberTheory:-NextSafePrime\left(%EXPR\right)"}\right]{,}\left[{"Number of Positive Divisors"}{,}{"NumberTheory:-tau\left(%EXPR\right)"}\right]{,}\left[{"Number of Prime Factors"}{,}{"NumberTheory:-Omega\left(%EXPR\right)"}\right]{,}\left[{"Number of Primes"}{,}{"NumberTheory:-pi\left(%EXPR\right)"}\right]{,}\left[{"Previous Prime"}{,}{"prevprime\left(%EXPR\right)"}\right]{,}\left[{"Primitive Root"}{,}{"NumberTheory:-PrimitiveRoot\left(%EXPR\right)"}\right]{,}\left[{"Pseudo Primitive Root"}{,}{"NumberTheory:-PseudoPrimitiveRoot\left(%EXPR\right)"}\right]{,}\left[{"Sum of Divisors"}{,}{"NumberTheory:-sigma\left(%EXPR\right)"}\right]\right]\right]\right]$ (1)

The GetGeneratedSubmenuAndAction command retrieves a given submenu. For example, to get just the Plots submenu:

 > $\mathrm{GetGeneratedSubmenuAndAction}\left(1.0,\left["Plots"\right]\right)$
 $\left[\left[{"Plot Builder"}{,}{"x -> InteractivePlotBuilder:-BuildPlot\left(op\left(x\right),\left(\text{'}contextmenu\text{'}\right) = true\right)"}\right]\right]$ (2)

It is also possible to retrieve nested submenus:

 > $\mathrm{GetGeneratedSubmenuAndAction}\left(1,\left["Units","Affix Unit","Atomic"\right]\right)$
 $\left[\left[{"bohr"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron mass"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron per second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron*bohr"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron*bohr^2/volt"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron/bohr^2"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron^2/hartree"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"electron_mass*bohr/second^2"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"hartree"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"hartree per second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"hartree/bohr"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"hartree/tesla"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"hartree/tesla*bohr^3"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"hartree/tesla^2"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"permittivity"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"planck"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"tesla"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"volt"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"volt*second"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"volt*second^2/electron"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]{,}\left[{"volt/bohr"}{,}{"%EXPR * Unit\left(%ARG1\right)"}\right]\right]$ (3)

Compatibility

 • The ContextMenu[Test][GetGeneratedSubmenuAndAction] command was updated in Maple 2017.