Replaceable Content - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : Information : Updates : Maple 2016 : updates/Maple2016/ReplaceableContent

Replaceable Content

 

Maple 2016 improves on the programmatic content generation tools introduced in Maple 2015.  DocumentTools:-InsertContent allows the insertion into a worksheet a block of worksheet content, called a task.  With a new option, you can programatically replace a task with new content:

• 

replaceid: replace previously inserted worksheet content

 

In this example we create an application that constructs new user interface elements on the fly.  That is, we start with a plot and a table.  On each click of the plot, we tear down the whole interface and rebuild it as a plot and a bigger table.  This allows us to redefine the user interface as needed.

 

Step 1: Execute this Code Edit region

PlotAndFunctionTable() procedure

Step 2: Execute the following command, and then click on the plot to add points to the table

PlotAndFunctionTabletanx,cotx;

click on the plot to add points to the table below

x

click-y

tanx

cotx

0.00

0.00

0

undefined

-5.48

0.95

1.031031258

.7078304460

-2.35

1.03

1.013618230

.6028548851

0.78

0.95

.9965031975

.7078304460

3.92

1.03

.9796761602

.6028548851

The definition of the procedure in the Code Edit region is given below.  The flow is:

 

• 

PlotAndFunctionTabletanx,cotx; — calls ModuleApply, which generates the worksheet XML, and injects it into the current document via DocumentTools:-InsertContent.

• 

Click() — when a user clicks on the plot, the Click() method is called.  This generates new worksheet XML and replaces the old interface via a call to DocumentTools:-InsertContent, giving it the replaceid option with the name of any one of the components present in the original task.