ContextMenu[CurrentContext][Queries] - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : Context-Sensitive Menus : CurrentContext : Queries : ContextMenu/CurrentContext/Queries/Add

ContextMenu[CurrentContext][Queries]

  

Add

  

add query for use within context menu module

 

Calling Sequence

Parameters

Description

Examples of Queries[Add]

Calling Sequence

Queries[Add](nm, query)

Parameters

nm

-

string; name by which query is referenced

query

-

procedure; returns information about the right-clicked object

Description

• 

The Queries[Add] command adds query to the set of recognized queries under the name nm.

• 

The nm parameter is the name by which the query is used and referenced by the context menu module.  The query parameter is a procedure applied to the selected object.

• 

Note that if a query is boolean-valued, meaning it returns true, false, or FAIL, then nm may be used in the test parameter to the Entries[Add] command. This indicates that the appearance of the associated entry in the context menu is dependent on the return value of query.

• 

In addition to their use in Entries[Add], queries may be called by entry generators (see EntryGenerators) or by other queries using the Run command.

Examples of Queries[Add]

with(ContextMenu[CurrentContext]):

  

Add a query that lists the exports of a specified module.

Queries[Add]("Exports",    proc(e) [exports(e)] end proc);

  

Add a query that returns the number of exports a specified module has.

Queries[Add]("NumExports", proc(e) nops(RunQuery("Exports", e)) end proc);

  

Add a query that tests that the specified module has exactly five exports.

Queries[Add]("5 exports",  proc(e) evalb(RunQuery("NumExports", e) = 5) end proc);

See Also

ContextMenu

ContextMenu[CurrentContext][Queries]

Queries/Get

Queries/List

Queries/Run

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam