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 QuestionDialog element.
2. Actions associated with onapprove and ondecline must be given by a reference and located outside the QuestionDialog 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 abnormalshutdown and the "onstartup" option.
maplet2 := Maplet( 'abnormalshutdown' = "FAIL",
'onstartup' = 'A0',
QuestionDialog( 'reference' = 'QD1',
'caption' = "Is x > 0 ?",
'title' = "Warning: Contradiction",
'onapprove' = 'A1',
'ondecline' = 'A2'
),
# Start the QuestionDialog.
Action( 'reference' = 'A0',
RunDialog( 'dialog' = 'QD1' )
),
# When "OK" is clicked, return true.
Action( 'reference' = 'A1',
Shutdown( 'value' = "true" )
),
# When "Cancel" is clicked, return FAIL.
Action( 'reference' = 'A2',
Shutdown( 'value' = "FAIL" )
)
):
|
>
|
result := parse(Maplets[Display](maplet2));
|