User Guide

User-Defined Procedure and Maplet Code
Define a procedure to be accessed in the Maplet.
GetColor:=proc()
local R, G, B, result;
use Maplets[Tools] in
# Convert the color value defined in the Color dialog
result:=Get(ColorDialog1);
# The result format is "#RRGGBB" in hexadecimal(base 16)
# Convert to values in the range 0..1
R:=convert(result[2..3], 'decimal', 16)/255;
G:=convert(result[4..5], 'decimal', 16)/255;
B:=convert(result[6..7], 'decimal', 16)/255;
# Plot the function entered in the MathMLEditor region
plot(MathML:-Import(Get(MathMLEditor1)), x=0..10,
color=COLOR(RGB, R, G, B));
end use:
end proc:
>
Load the Elements package.
with(Maplets[Elements]):>
Define the Maplet application.
9.4 Authoring Maplets 359