DocumentTools[Canvas]
ScriptCheckBox
create a checkbox element for a canvas
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
ScriptCheckBox(caption)
ScriptCheckBox(caption, command, options)
caption
-
string
command - appliable
custom - string
encode - truefalse
include - list(name)
ischecked - truefalse
parameters - list
position - [x,y], or identical(below,right)
visible - truefalse
The ScriptCheckBox command creates a canvas "checkbox" element, which can be queried from the canvas during a button action.
By default, ischecked = false
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.
Set visible = false to hide the button. This can be used in conjunction with the event option, or the onclick option of StaticPlot.
If desired, the second argument, command, can be used to specify an action to invoke when the checkbox is clicked. This command is usually defined as the name of a Maple procedure, and follows the same pattern of commands defined in the ScriptButton command, along with options encode, include, parameters, and defineproc.
In this example you can select (check) and unselect the checkbox. The message will not be updated until the Test button is pressed.
with⁡DocumentTools:-Canvas:
testcheckbox := proc (canvas) local M; M := GetElements(canvas,"checkbox"); local sc := Script(); SetActive(sc,"out"); SetText(sc,`if`(M[1]:-ischecked=true,"Checked","Not Checked") ); ToString(sc); end proc:
cv≔NewCanvas⁡ScriptCheckBox⁡Caption A,custom=A,Text⁡,custom=out,ScriptButton⁡Test,testcheckbox:
ShowCanvas⁡cv
In this example the checkbox has an action handler to show and hide the button immediately when you click it.
showhide := proc( canvas ) local M, sc; M := GetElements(canvas,"checkbox"); sc := Script(); SetButton(sc,"The Button","visible",M[1]:-ischecked); ToString(sc); end proc:
cv≔NewCanvas⁡ScriptButton⁡The Button,,ScriptCheckBox⁡The Button is Visible,showhide,ischecked=true,custom=cb:
The DocumentTools[Canvas][ScriptCheckBox] command was introduced in Maple 2022.
For more information on Maple 2022 changes, see Updates in Maple 2022.
The DocumentTools[Canvas][ScriptCheckBox] command was updated in Maple 2025.
The visible and command options were introduced in Maple 2025.
For more information on Maple 2025 changes, see Updates in Maple 2025.
See Also
Annotate
GetCanvas
GetMath
Math
NewCanvas
Script
ScriptButton
ShareCanvas
Text
Download Help Document