DocumentTools/Canvas/ScriptButton - Maple Help

Home : Support : Online Help : DocumentTools/Canvas/ScriptButton

DocumentTools[Canvas]

 ScriptButton
 create a button element for a canvas

 Calling Sequence ScriptButton(caption, command) ScriptButton(caption, command, options)

Parameters

 caption - string command - appliable encode - (optional) truefalse position - (optional) [x,y], or identical(below,right),

Description

 • The ScriptButton creates a canvas "button" element, which, when viewed in a canvas can be clicked to execute the supplied command.
 • By default, encode = true, which causes the given command to be serialized into an encoded string.  This simplifies embedding of the button command in the canvas' XML source code.  For simple commands, and as an aid to debugging, setting encode = false can be useful.
 • The position option can be used to specify absolute coordinates for the location of the button on a canvas, or a relative position below or to the right of the previous component.

Examples

 > $\mathrm{with}\left(\mathrm{DocumentTools}:-\mathrm{Canvas}\right):$
 > LocateVariables := proc( canvas )    local script := Script(':-canvas'=canvas);    for local m in GetMath(canvas) do        script:-SetActive(script,m);        local vars := indets(m:-math);        for local v in vars do           script:-Highlight(script,v);        end do;    end do;    script:-ToString(script); end proc:
 > $\mathrm{cv}≔\mathrm{NewCanvas}\left(\left["Write An Expression with Variables",\mathrm{ScriptButton}\left("Identify Variables",\mathrm{LocateVariables},\mathrm{position}=\left[500,50\right]\right)\right]\right):$
 > $\mathrm{ShareCanvas}\left(\mathrm{cv}\right)$
 > $\mathrm{ShowCanvas}\left(\mathrm{cv}\right)$

Compatibility

 • The DocumentTools[Canvas][ScriptButton] command was introduced in Maple 2021.
 • For more information on Maple 2021 changes, see Updates in Maple 2021.