In this example, we will create a script that modifies math on a canvas
>
|
|
This is the procedure that will be called when we click the button. Note that the last line of this procedure is a call to ToString(script), which is essential in order for this to work in Maple Learn
>
|
Complexify := proc( canvas )
uses DC=DocumentTools:-Canvas;
randomize();
local script := DC:-Script();
for local m in DC:-GetMath(canvas,'inert') do # get all the math in the canvas
SetActive(script,m); # set the location of the annotation
local newexpr := RandomTools:-RandomExpand(m:-math);
SetMath(script,newexpr);
end do;
ToString(script);
end proc:
|
Create and deploy the canvas
>
|
|