ToString - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


DocumentTools[Canvas][Script]

  

ToString

  

set the contents of a math canvas element

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

ToString(script)

Parameters

script

-

DocumentTools:-Canvas:-Script object

Description

• 

The ToString command converts the given script object to an XML string that can be used as the return value of a button-press in Maple Learn.

Examples

In this example, we will create a script that modifies math on a canvas

withDocumentTools:-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

cvNewCanvasWrite some expressions anywhere, then press the button to 'complexify' your input into something equivalent but more complicated!,ScriptButtonComplexify,Complexify:

ShareCanvascv

Compatibility

• 

The DocumentTools[Canvas][Script][ToString] command was introduced in Maple 2021.

• 

For more information on Maple 2021 changes, see Updates in Maple 2021.

See Also

Math

NewCanvas

Script

SetActive

SetText