Canvas Elements and Layout
This page describes the layout rules and basic elements of a canvas in Maple and Maple Learn.
Row/Column Layout
Groups
Pixel Position
Mixed Text and Math
Plots
CheckBoxes
Buttons
Data Tables
Sliders and Assignments
Images
Math Attributes
MathML and Inert Form
Special Characters
Appending to a Canvas
Next Steps
The NewCanvas command accepts a list of elements as input. Each element is its own row. Use a sublist to place multiple items on the same row.
https://learn.maplesoft.com/#/?d=HFOTLSIUGLCHCFHNPJDQLUFIOLFRDRBODTONFGEJOMJLBPFUEQAKOQOFLJIMNKANCKAMOSJSDNMKEOPRHPFPJUKTHTOFATNUDNPJ
A Group is denoted as a box around several items in the Maple Learn interface. There is no visual indication of a group in the Maple interface, but grouped items do affect the id that might be used by Script:-SetActive.
By default, each item passed to NewCanvas will be put in its own group.
https://learn.maplesoft.com/#/?d=EQEPIPMFOHLHCOKRKMLLHMBMPIOIGNFOHHJHBPMPBMMROLEUGJMRLRGKBLEUMNJTGLFNAKKIEIPPGLIFJGGJEHDUOJAJMLAOIIPQ
To collect them together, wrap them in Group([...]);
https://learn.maplesoft.com/#/?d=LKMHKNBFMJMPGJCUENGFHFDSITPTATJLBGJLBSJICMASPFBUAPIHIFMOAFCUMPAQIJLRFIKQCSKFFTEIMPFTKJNLOHDICSDJFGHF
Here is another example that shows groups in two columns.
https://learn.maplesoft.com/#/?d=NRIKAUHRFPKNFTCSBQFPEHDQLUOSKRKFOMNFLUKSDRHGGHLODMKUEUJSFJCNJNJHNLGPHJBSMLOUBPOUKRGGINLFNGKOKQGKFPAL
Items can be placed at a pixel position. Only the Maple Learn interface respects the exact pixel placement; the Maple Interface finds an approximate position within its grid. Note that the default for ShowCanvas is to locate items on a best-fit basis on a 2-column grid. Use the size option to create a finer grid.
The longest row in the input list above has a length of 1. Therefore the default grid size of 2-columns will be used by ShowCanvas, and each of the elements will be adjusted into approximate boxes.
The size is specified to have 4 rows and 10 columns here—creating a finer grid. The adjusted placement will be closer to the pixel position used by Maple Learn. Note that we don't need to recreate the canvas, we are simply showing it again with a different size.
https://learn.maplesoft.com/#/?d=DJDMMMIHFHPNAKKQMTNGAGPGHRKOFRARINPMPPOLOSFLOPGKETJGNRPREHHKLTBTKJLSEOFIPNGSOLPIKGEOEMIFESLNLUMIMLDH
As seen previously, string input will be added as text and expressions will be added as math. The Text and Math commands can also be used, and are needed when you want to specify options. The Text constructor can also be used to create a message that mixes formatted math into the text message. Use %1, %2, etc. as placeholders, and add the expression to fill in at the end.
https://learn.maplesoft.com/#/?d=BSAMOQBGJOOSFFLQMPOGFLOSIQPKGMNRIMNOAHIUMSCRBPJRPMAJPTHKCIDPONOSOTJNAPEUKGIFIIGLPPBNCLNLAQFTCRDROUIF
Use the StaticPlot command to insert a 2-D plot into a canvas.
https://learn.maplesoft.com/#/?d=IHELHNANNSIIDTJILPLGBUMGFTBKFHJHCPNNLIILIUEUMIMHASFQLTKONUDHAKMGIFAMIJGHLOBTPNNNDICNHPOHITJLDNAOJKPH
Use the Plot3D command to insert a 3-D plot.
https://learn.maplesoft.com/#/?d=MHNOCOKGJSOUMJEHCUFGIOMFIJJJNJPLJJDNDNEHFHCRCKMGGHHSFGCPKMCQDPCTIPOHBGGREJFTBMJNKOKJNRPTCMJMALKJKRPL
Checkboxes are elements that can be queried in a Script.
https://learn.maplesoft.com/#/?d=CSIMBSLNNFHOOUFPEFIQISMKNOFOEJGLOFKKMIDTANJQKSKHIUPIFRGIBKKSHHOTFUOGHREUIPDSLQILORDFMRHPGROOGIOMAMPI
Buttons can trigger actions that invoke a Script.
https://learn.maplesoft.com/#/?d=IKLQFRPQOQFQNQEKPPFFGNNNEUNKEMFGELMUDIDGHTOIAFCNIJJRCUIMLFPLGFHSJUBUHGMGLQEGNNFIKGPHCFATBRFMOPMLDNPP
A table of elements is a powerful feature in Maple Learn. Use a DataFrame to insert a table. Note: In Maple, the row and column labels will be visible, while in Maple Learn, only non-default specified column or row labels will be shown. In Maple Learn, omit the 'columns' label to get a horizontal table, and omit the 'rows' label to get a vertical table.
https://learn.maplesoft.com/d/LJDLIPBTDMKLFNDRCUGPHFDNENBUJFPLCIFPNGFTFNKJNMOHKPKRGKPOINKUJFJQEGMPCUAKBGDNBJFOMPIGPKHMAQBSCMPLCSKJ
A slider shows up in Maple Learn when you assign a variable to a numeric value. The Slider constructor takes the variable name, and initial value as an equation.
https://learn.maplesoft.com/#/?d=PTBOJSINHHBMGPFOETCJHSOJOLJQPPIPFOLSARFMCIEGOQCSBMJNJLHKEILLOHGRBMCJDQJSATAJNMNOPPEFPTGQJKHGPONSMMBF
Sliders are a special case of a variable assignment. To create an assignment without a slider, use the `&coloneq`(n,3) to set n := 3;
https://learn.maplesoft.com/#/?d=GTJTGSGODTOUCUPFHLJLCRKGGONRIJPPAOHHEFCLAPKLDUCPFTPSLOPROOJGLSALMQFJLFOIHFHQESLTERAMIFJMNSKQJKLPAHCQ
Slider properties can also be set using a Math constructor with additional options.
https://learn.maplesoft.com/#/?d=PJLKLJKHKOPKGLCRKKCKBUFRCOJNHIDPBKESBSHTGFAMIKDODQLSBOOGONLNJLHJFPGLPNMTMGFPIRKOAMMQCIKIKLKNKGJLLKEH
Images can be embedded into a canvas. In order to upload an image you need to be signed into the MapleCloud. There are also options to pick an Image out of an existing canvas.
https://learn.maplesoft.com/#/?d=MMMTMMFKAGLFANDREOJKLRCTGGAPBIGFGQJSBGNGNUPKKLDGLOGUJRBOPLKRNLAQLIFLCQENHMGUEQDPLNANCOESLSPMJSBIIKOG
The Math constructor accepts a variety of options.
https://learn.maplesoft.com/#/?d=OMNOIOGKPINMAUITBUALAMKRPFJFCFMSGLKRIPIPEPPOAPFTGKKRMQLFNGHRCUCKLRIGLOLSOFILLHPLCFAPASMHIIASBSDTLILH
When fetching a canvas from Maple Learn, the GetMath command calls Math(...) to create record structures.
Some tricks can be used to format the math, such as using InertForm to prevent automatic simplification. Here Typesetting:-mspace() is also used to create a blank:
Incomplete expressions that can't be represented as a Maple data structure can be written directly in MathML. Here is an example that leaves the numerator of a fraction blank.
Greek letters and math symbols can usually be spelled out, or their entity name used, or the character itself can be pasted in as input. Here are some examples:
https://learn.maplesoft.com/#/?d=OOGFNIGKETGIGIMRFJFGFTNPHPAOMLCLGPNPOTNIKMMFINKFJHBRLQPLHGLOEPLOFTDKMJORJGMMGPOFGPHKKUPHKPDMKMNHJUHU
Placement is relative to the math above. We have a mismatch of height on the left and right. Sometimes you have to try alternative layouts.
https://learn.maplesoft.com/#/?d=ATNKNFDMMQMFFKDQMRBHGSBPGNHPLLIHCQLRMPATPHPMIHOLEOKPNJGUGIFSEUEKLQFLLILFIKNSPHGOATGHJIHHESDHNQKHNJAN
Sometimes it is easiest to use the Maple Learn interface to create your layout and add appropriate elements. You can create it in Maple Learn, share the document, and then pull it into Maple. Here's an example:
https://learn.maplesoft.com/#/?d=HTPJDUAUCFOHISHONKGNOUPSCNBKKOHPIHLPCMBINRFSKJAHJKJSEUKSINDKGLCFJSDMIGDGDLMREJGQBFALCFDHGTAIINJFJOFS
Introducing the Script Button
Return to DocumentTools[Canvas] Overview Page
Download Help Document