define an action - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Maplets : Elements : Other Elements : Maplets/Elements/Action

Maplets[Elements][Action] - define an action

Calling Sequence

Action(opts, element_content)

Action[refID](opts, element_content)




equation(s) of the form reference=value; specify options for the Action element



any number of Action or command elements



name or string; reference to the element



The Action element defines an action in a Maplet application.


The Action element features can be modified by using options.  To simplify specifying options in the Maplets package, certain options and contents can be set without using an equation. The following table lists elements, symbols, and types (in the left column) and the corresponding option or content (in the right column) to which inputs of this type are, by default, assigned.

Elements, Symbols, or Types

Assumed Option or Content




reference option




An Action element can contain any number of other Action elements or command elements such as CloseWindow, Evaluate, SetOption, RunWindow, RunDialog, and Shutdown.


An Action element can be contained in a Maplet element; in an equation for the onapprove, oncancel, onchange, onclick, ondecline, or onstartup option for an element; or as a parameter in an element that accepts an onchange or onclick option without an equation.


The contents of an Action element are evaluated in order. Each action is completed before the next is started.  The contents of any nested Action elements are evaluated in order.


The following table describes the control and use of the Action element options.


An x in the I column indicates that the option can be initialized, that is, specified in the calling sequence (element definition).


An x in the R column indicates that the option is required in the calling sequence.


An x in the G column indicates that the option can be read, that is, retrieved by using the Get tool.


An x in the S column indicates that the option can be written, that is, set by using the SetOption element or the Set tool.



























The opts argument can contain one or more of the following equations that set Maplet application options.




reference = name or string


A reference for the Action element.


If the reference is specified by both an index, for example, Action[refID], and a reference in the calling sequence, the index reference takes precedence.




run = true


This is a settable field that indicates that the specified action be run as soon as control returns to the Maplet application. This is useful for specifying the conditional shutdown of a window.


A Maplet application that has actions associated with buttons:




Note that this Maplet application can more easily be written as:



See Also

Maplets/CommandElements, Maplets[Display], Maplets[Elements], Maplets[Elements][Button], Maplets[Elements][Maplet], Maplets[Elements][SetOption], Maplets[Elements][Shutdown], Maplets[Elements][TextField], Maplets[Tools][Get], Maplets[Tools][Set], Overview of Maplet Applications

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