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.
# 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',
# Run the Maplet application.