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 ConfirmDialog element.
2. Actions associated with onapprove, ondecline, and oncancel must be given by a reference, and located outside the ConfirmDialog 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 referenced by A0.
maplet2 := Maplet( 'abnormalshutdown' = "FAIL", 'onstartup' = 'A0',
ConfirmDialog( 'reference' = 'AD1',
'caption' = "Assuming x > 0 leads to a contradiction",
'title' = "Warning: Contradiction",
'onapprove' = 'A1',
'ondecline' = 'A2',
'oncancel' = 'A3'
),
# Starts the ConfirmDialog.
Action( 'reference' = 'A0',
RunDialog( 'dialog' = 'AD1' )
),
# Define the resulting action if "Yes" is clicked.
Action( 'reference' = 'A1',
Shutdown( 'value' = "true" )
),
# Define the resulting action if "No" is clicked.
Action( 'reference' = 'A2',
Shutdown( 'value' = "false" )
),
# Define the resulting action if "Cancel" is clicked.
Action( 'reference' = 'A3',
Shutdown( 'value' = "FAIL" )
)
):
|
>
|
result := parse(Maplets[Display](maplet2));
|