Maple für Professional
Maple für Akademiker
Maple für Studenten
Maple Personal Edition
Maple Player
Maple Player für iPad
MapleSim für Professional
MapleSim für Akademiker
Maple T.A. - Testen & beurteilen
Maple T.A. MAA Placement Test Suite
Möbius - Online-Courseware
Machine Design / Industrial Automation
Luft- und Raumfahrt
Fahrzeugtechnik
Robotics
Energiebranche
System Simulation and Analysis
Model development for HIL
Anlagenmodelle für den Regelungsentwurf
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematikausbildung
Technik
Allgemein- und berufsbildende Schulen
Testen und beurteilen
Studierende
Finanzmodelle
Betriebsforschung
Hochleistungsrechnen
Physik
Live-Webinare
Aufgezeichnete Webinare
Geplante Veranstaltungen
MaplePrimes
Maplesoft-Blog
Maplesoft-Mitgliedschaft
Maple Ambassador Program
MapleCloud
Technische Whitepapers
E-Mail Newsletters
Maple-Bücher
Math Matters
Anwendungs-Center
MapleSim Modell-Galerie
Anwenderberichte
Exploring Engineering Fundamentals
Lehrkonzepte mit Maple
Maplesoft Welcome-Center
Resource-Center für Lehrer
Help-Center für Studierende
Sample Maplet Application: Message
This worksheet demonstrates how to write Maplet applications that function similarly to the Message Maplet application available in the Maplets[Examples] package. It is designed for experienced Maple authors.
Simple Example
restart:
# Invoke the Maplets Elements subpackage. with(Maplets[Elements]): # Define the message Maplet application. maplet1 := Maplet( MessageDialog( # The text that appears in the Maplet application. "The result is saved in `myfile.txt`", # Define the Maplet application title. 'title' = "Computation Finished", # The action that occurs when "OK" is # clicked. 'onapprove' = Shutdown() ) ):
# Run the Maplet application. Maplets[Display](maplet1);
Complex Example
The following example does not use any of the simplifications that have been included to make writing Maplet applications easier which leads to longer code but faster execution and for more complex Maplet applications, greater control of the Maplet application appearance and behavior. The required changes are:
1. An onstartup action must be specified. This action must be referenced and contain a RunDialog element which starts the MessageDialog element.
2. Actions associated with onapprove and ondecline must be given by a reference and located outside the MessageDialog element. The command elements must be wrapped in Action elements.
3. All option names must be specified, including caption, reference, and value.
with(Maplets[Elements]): # Define the "onstartup" option to be A0. maplet2 := Maplet( 'onstartup' = 'A0', MessageDialog( 'reference' = 'AD1', 'caption' = "The result is saved in `myfile.txt`", 'title' = "Computation Finished", 'onapprove' = 'A1' ), # Starts the MessageDialog. Action( 'reference' = 'A0', RunDialog( 'dialog' = 'AD1' ) ), # When "OK" is clicked, the Maplet application shuts down. Action( 'reference' = 'A1', Shutdown() ) ):
# Run the Maplet application. Maplets[Display](maplet2);
Comparison
Maplet applications can be viewed by using the Maplets[Tools][Print] function. This function prints the XML data structure of the Maplet application.
Compare the resulting output of the two example Maplet applications. Note that the only major difference is that the first example replaces the name references with "_Maplets_reference_#", where # is a unique number, and the second example leaves the string references unchanged.
Maplets[Tools][Print](maplet1);
Maplets[Tools][Print](maplet2);
Maplets[Examples][Message]
The Maplets[Examples][Message] function displays a Maplet application similar to that of the previous examples. The function, however, allows the user to modify the caption and title options.
For help on this Maplet application, see:
?Maplets[Examples][Message]
To view the source code, enter:
print( Maplets[Examples][Message] );
See Also
Maplets[Examples], Maplets[Examples][Message], Maplets[Elements][MessageDialog]
Return to Index for Example Worksheets
Download Help Document