|
Calling Sequence
|
|
ScriptCheckBox(caption)
ScriptCheckBox(caption, command, options)
|
|
Parameters
|
|
|
|
Options
|
|
•
|
position - [x,y], or identical(below,right)
|
|
|
Description
|
|
•
|
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.
|
|
|
Examples
|
|
In this example you can select (check) and unselect the checkbox. The message will not be updated until the Test button is pressed.
>
|
|
>
|
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:
|
>
|
|
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:
|
>
|
|
|
|
Compatibility
|
|
•
|
The DocumentTools[Canvas][ScriptCheckBox] command was introduced in Maple 2022.
|
•
|
The DocumentTools[Canvas][ScriptCheckBox] command was updated in Maple 2025.
|
•
|
The visible and command options were introduced in Maple 2025.
|
|
|
|