To refine the Maplet application:
1. Add a title to the Maplet application.
2. Process the output.
By default, one window is used in the first example. To customize the window with, for example, a title, the layout must be wrapped in a Window element. Similarly, the text "Enter an expression:" is wrapped in a BoxCell element.
>
|
with(Maplets[Elements]):
maplet := Maplet(
# Label the Maplet application title bar.
Window( 'title' = "Enter an Expression",
[
BoxCell( "Enter an expression:", left ),
TextField['TF1'](),
Button( "OK", Shutdown( ['TF1'] ) )
]
)
):
# Assign result to the value returned by the Maplet application.
result := Maplets[Display](maplet):
# Specify the error message returned if an expression
# is not entered.
if result = NULL then
error "request failure, an expression was not entered";
else
result := parse( result[1] );
if type( [result], ['algebraic'] ) then
result;
else
error "%1 is not of type `%2`", [result], [algebraic];
end if;
end if;
|