DocumentTools[Canvas][Script]
SetChecked
set the value of a checkbox
Calling Sequence
Parameters
Description
Examples
Compatibility
SetChecked(script,custom,value)
script
-
DocumentTools:-Canvas:-Script object
custom
the custom attribute of the given checkbox
value
truefalse
The SetChecked command sets the value and visual property of the given checkbox to selected or not selected. Unlike math and text containers, the SetActive command is not used as a precursor to this command. Instead, the custom property of the checkbox is named as the second argument to identify which checkbox to set.
In this example two checkboxes are presented with a number of buttons that will perform actions either setting or clearing the ischecked property.
with⁡DocumentTools:-Canvas:
Toggle := proc( canvas, cb, { mode::identical("toggle","clear","set") := "toggle" } ) local sc := Script(); if mode in {"set", "clear"} then local val := `if`(mode="set",true,false); for local elem in cb do sc:-SetChecked(sc,elem,val); end do; else local M := GetElements(canvas,{"checkbox"}); for local elem in M do if elem:-custom in cb then sc:-SetChecked(sc,elem:-custom,not elem:-ischecked); end if; end do; end if; ToString(sc); end proc:
cv≔NewCanvas⁡ScriptCheckBox⁡Caption A,custom=A,ScriptCheckBox⁡Caption B,custom=B,ScriptButton⁡Toggle A,Toggle,parameters=A,ScriptButton⁡Toggle B,Toggle,parameters=B,ScriptButton⁡Clear All,Toggle,parameters=A,B,mode=clear,ScriptButton⁡Set All,Toggle,parameters=A,B,mode=set:
The DocumentTools[Canvas][Script][SetChecked] command was introduced in Maple 2023.
For more information on Maple 2023 changes, see Updates in Maple 2023.
See Also
GetMath
Script
ScriptCheckBox
SetActive
Download Help Document