Setting up actions

(Excerpt from "The MathML Handbook" by Pavi Sandhu)

The maction element provides a mechanism for adding interactivity to MathML equations. This element associates a type of action with an MathML expression. You can then program a processing application to perform the specified action in response to a user event (such as clicking or moving the mouse over the MathML expression).

An maction element can contain any other MathML elements and can have any number of arguments. This element has the following two attributes:

  • selection: is an integer that identifies one of the arguments of the maction element. The value 1 refers to the first argument, 2 to the second argument, and so on. This attribute provides a way to refer to subexpressions of the maction element — for example, in cases where the intended action is to toggle between different subexpressions. The argument of the maction element that corresponds to the specified value of the selection attribute is called the selected subexpression.
  • actiontype: specifies the action to be performed. The allowed values of this attribute are not defined by the MathML specification. Instead, each MathML application is expected to define its own values depending on the type of actions it supports.

Some examples of possible values of actiontype along with the actions associated with them are given below. Note that all these example are hypothetical. They are provided only to illustrate the concept. For these values of the actiontype attribute to work as indicated, they must first be implemented by a specific application. A MathML application that does not recognize a value specified for actiontype will just render the selected subexpression without performing the action.

With actiontype="toggle", a rendering application would display one of a given series of subexpressions. Each time the user clicks the displayed subexpression, the renderer would update the value of selection by 1 and cause the next expression in the series to be displayed. Here is an example illustrating this behavior:

<maction actiontype="toggle" selection="1">
   (expression1)
   (expression2)
</maction>

With actiontype="statusline", clicking or moving the mouse over an expression would cause the specified message to appear in the status line of the browser, as shown here:

<maction actiontype="statusline">
  (expression)
  (message)
</maction>

With actiontype="tooltip", clicking or moving the mouse over an expression would cause the message to be displayed in a pop-up tooltip box near the expression, as follows:

<maction actiontype="tooltip">
  (expression)
  (message)
</maction>

With actiontype="highlight", clicking or moving the mouse over an expression would cause the message to be displayed in a different color and/or with a different background, as shown here:

<maction actiontype="highlight" xhtml:color="red" xhtml:background="yellow">
  expression
</maction>

In the above example, the color and background are specified by two other attributes from a different namespace.

With actiontype="menu", clicking or moving the mouse over an expression would cause a pop-up menu to be displayed. A typical MathML expression using this attribute would have the following structure:

<maction actiontype="menu" selection="1">
  (menu item 1)
  (menu item 2)
</maction>

The items in the menu above are determined by the arguments of the <maction> element. Since a <maction> element can contain any other MathML elements, each menu item could itself be a MathML expression, to allow a user to choose from different forms of an expression.

   

<< back next >>

 

 

 


 

Copyright © CHARLES RIVER MEDIA, INC., Massachusetts (USA) 2003
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "The MathML Handbook" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.


CHARLES RIVER MEDIA, INC., 20 Downer Avenue, Suite 3, Hingham, Massachusetts 02043, United States of America