DocumentTools[Canvas]
ScriptButton
create a button element for a canvas
Calling Sequence
Parameters
Description
Examples
Compatibility
ScriptButton(caption, command)
ScriptButton(caption, command, options)
caption
-
string
command
appliable
encode
(optional) truefalse
position
(optional) [x,y], or identical(below,right),
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.
with⁡DocumentTools:-Canvas:
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:
cv≔NewCanvas⁡Write An Expression with Variables,ScriptButton⁡Identify Variables,LocateVariables,position=500,50:
ShareCanvas⁡cv
ShowCanvas⁡cv
The DocumentTools[Canvas][ScriptButton] command was introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
See Also
Annotate
GetCanvas
Math
NewCanvas
Script
ShareCanvas
Text
Download Help Document
What kind of issue would you like to report? (Optional)