DocumentTools/Canvas/ScriptButton - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : DocumentTools/Canvas/ScriptButton

DocumentTools[Canvas]

  

ScriptButton

  

create a button element for a canvas

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

ScriptButton(caption, command)

ScriptButton(caption, command, options)

Parameters

caption

-

string

command

-

appliable

encode

-

(optional) truefalse

position

-

(optional) [x,y], or identical(below,right),

Description

• 

The ScriptButton creates a canvas "button" element, which, when viewed in a canvas can be clicked to execute the supplied command.

• 

By default, encode = true, which causes the given command to be serialized into an encoded string.  This simplifies embedding of the button command in the canvas' XML source code.  For simple commands, and as an aid to debugging, setting encode = false can be useful.

• 

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.

Examples

withDocumentTools:-Canvas:

LocateVariables := proc( canvas )
   local script := Script(':-canvas'=canvas);
   for local m in GetMath(canvas) do
       script:-SetActive(script,m);
       local vars := indets(m:-math);
       for local v in vars do
          script:-Highlight(script,v);
       end do;
   end do;
   script:-ToString(script);
end proc:

cvNewCanvasWrite An Expression with Variables,ScriptButtonIdentify Variables,LocateVariables,position=500,50:

ShareCanvascv

ShowCanvascv

Compatibility

• 

The DocumentTools[Canvas][ScriptButton] command was introduced in Maple 2021.

• 

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

See Also

Annotate

GetCanvas

Math

NewCanvas

Script

ShareCanvas

ShareCanvas

Text