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

  

SetButton

  

set a property of a button

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

SetButton(script,caption,property,value)

Parameters

script

-

DocumentTools:-Canvas:-Script object

caption

-

string : the caption of the button to operate on

property

-

string : the name of the property to set

value

-

the value of the property

Description

• 

The SetButton command sets the specified property of the given button. Unlike math and text containers, the SetActive command is not used as a precursor to this command.  Instead, the caption of the button is used to identify the button to change.  If there is more than one button with the same caption, only the first found will be updated.

Examples

In this example there are four buttons.  The first button does not have an action associated with it.  The remaining buttons modify properties of the first button.

withDocumentTools:-Canvas:

toggle := proc(canvas,prop,source)
  local sc := Script();
  local me := GetElements(canvas,"button",filter={'name'=source[1]});
  if numelems(me) > 0 then
      SetButton(sc,"Target",prop,true);
      SetButton(sc,source[1],"caption",source[2]);
  else
      SetButton(sc,"Target",prop,false);
      SetButton(sc,source[2],"caption",source[1]);
  end if;
  ToString(sc);
end proc:

setprop := proc(canvas,prop,val)
  local sc := Script();
  SetButton(sc,"Target",prop,val);
  ToString(sc);
end proc:

cvNewCanvasScriptButtonTarget,,ScriptButtonDisable,toggle,parameters=enabled,Enable,Disable,ScriptButtonHide,toggle,parameters=visible,Show,Hide,ScriptButtonMake Red,setprop,parameters=color,red:

ShowCanvascv,entrybox=false

Compatibility

• 

The DocumentTools[Canvas][Script][SetButton] command was introduced in Maple 2025.

• 

For more information on Maple 2025 changes, see Updates in Maple 2025.

See Also

GetMath

Script

ScriptButton

SetActive

 


Download Help Document