Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
Sample Maplet Application: Show Table
This worksheet demonstrates how to write Maplet applications that function similarly to the Show Table Maplet application available in the Maplets[Examples] package. It is designed for experienced Maple authors.
The ShowTable Maplet application displays a window with a nested list in table format.
Simple Maplet Application
The following Maplet application creates a window with a table that displays values of sin(x) for x between 0 and 6.2.
# Invoke the Maplets Elements subpackage. with( Maplets[Elements] ):
# Define the Maplet application. maplet := Maplet( # The BoxLayout element structures the Maplet application # window into three rows. The BowLayout element # ensures that the rows are equidistant. [ "Values of the sine function:", # The TableLayout element creates a matrix-like # layout. Each row of the TableLayout element # contains: Table( ["x", "sin(x)"], [seq( [evalf[3](i/10), evalf[3](sin(i/10))], i = 0..62 )] ), # The OK button shuts down the Maplet application Button( "OK", Shutdown() ) ] ): # Display runs the Maplet application. Maplets[Display](maplet):
Note: This Maplet application lacks a title, the width is too narrow, and the OK button may not be visible. To improve this Maplet application, read the following Further Refinements section.
Further Refinements
To refine the Maplet application:
1. Add a title to the Maplet application.
2. Change the width.
3. Place the scroll bar on the BoxCell, not on the Table.
4. Change the font and color of the text.
By default, one window is used in the first example. To add a title, the layout must be wrapped in a Window element.
Similarly, the text "Values of the sine function" must be wrapped in a Label element, and the Table element wrapped in a BoxCell element, each with appropriate attributes.
maplet := Maplet( # The BoxLayout element structures the Maplet application # window into three rows. The BowLayout element # ensures that the rows are equidistant. Window( 'title' = "The Sine Function", [ Label( "Values of the sine function:", 'foreground' = COLOR(RGB, 1, 1, 0 ), 'font' = Font("helvetica", 14) ), BoxCell( 'vscroll' = 'as_needed', Table( 'width' = 200, ["x", "sin(x)"], [seq( [evalf[3](i/10), evalf[3](sin(i/10))], i = 0..62 )] ) ), Button( "OK", Shutdown() ) ] ) ): # Display runs the Maplet application. Maplets[Display](maplet):
Maplets[Examples][ShowTable]
The Maplets[Examples][ShowTable] function displays a similar Maplet application to that of the previous examples.
For help on this Maplet application, see:
?Maplets[Examples][ShowTable]
To view the source code, enter:
print( Maplets[Examples][ShowTable] );
See Also
Maplets/Examples, Maplets[Elements][Table]
Return to Index for Example Worksheets
Download Help Document