ScriptCheckBox - 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]

  

ScriptCheckBox

  

create a checkbox element for a canvas

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

ScriptCheckBox(caption)

ScriptCheckBox(caption, command, options)

Parameters

caption

-

string

Options

• 

command - appliable

• 

custom - string

• 

encode - truefalse

• 

include - list(name)

• 

ischecked - truefalse

• 

parameters - list

• 

position - [x,y], or identical(below,right)

• 

visible - truefalse

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.

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

cvNewCanvasScriptCheckBoxCaption A,custom=A,Text,custom=out,ScriptButtonTest,testcheckbox:

ShowCanvascv

In this example the checkbox has an action handler to show and hide the button immediately when you click it.

withDocumentTools:-Canvas:

showhide := proc( canvas )
    local M, sc;
    M := GetElements(canvas,"checkbox");
    sc := Script();
    SetButton(sc,"The Button","visible",M[1]:-ischecked);
    ToString(sc);
end proc:

cvNewCanvasScriptButtonThe Button,,ScriptCheckBoxThe Button is Visible,showhide,ischecked=true,custom=cb:

ShowCanvascv

Compatibility

• 

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