Close
Close window
Sample Maplet: Show Table - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


Home : Support : Online Help : Programming : Maplets : Examples : Advanced : Sample Maplet: Show Table
[フレーム] [フレーム]

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

Return to Index for Example Worksheets


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /