SetChecked - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


DocumentTools[Canvas][Script]

  

SetChecked

  

set the value of a checkbox

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

SetChecked(script,custom,value)

Parameters

script

-

DocumentTools:-Canvas:-Script object

custom

-

the custom attribute of the given checkbox

value

-

truefalse

Description

• 

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.

Examples

In this example two checkboxes are presented with a number of buttons that will perform actions either setting or clearing the ischecked property.

withDocumentTools:-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:

cvNewCanvasScriptCheckBoxCaption A,custom=A,ScriptCheckBoxCaption B,custom=B,ScriptButtonToggle A,Toggle,parameters=A,ScriptButtonToggle B,Toggle,parameters=B,ScriptButtonClear All,Toggle,parameters=A,B,mode=clear,ScriptButtonSet All,Toggle,parameters=A,B,mode=set:

Compatibility

• 

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