|
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.
>
|
|
>
|
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:
|
>
|
|
>
|
|
|
|
Compatibility
|
|
•
|
The DocumentTools[Canvas][Script][SetButton] command was introduced in Maple 2025.
|
|
|
|