Command-Line Maplets - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Maplets : Command-Line Maplets

Creating and Displaying Maplet Applications in Command-Line Maple

  

You can use the Command-Line version of Maple to create and display Maplet applications.

 

Description

Examples

Description

• 

To use Maplet applications in the Command-Line version, enter the Maplet application code at the Maple prompt as you would for Maple code.

• 

Alternatively, using a text editor, enter a Maplet application definition into a text file.  Save the text file with a .mpl extension.

  

Depending on your operating system, you can run the .mpl file by:

  

* Double-clicking it from your file browser or

  

* Entering maple and the filename as an argument at the command line.

  

The Maple code is executed in Command-Line Maple. If a Maplet application is defined with the Maplet[Display] command specified, it is displayed.

Examples

Copy the following Maplet application code into your Command-Line session.  Press ENTER.

with(Maplets[Elements]):

maplet := Maplet([
   "Click a Button:",
   [Button("OK", Shutdown("true")), Button("Cancel", Shutdown())]
]):

result := Maplets[Display](maplet);

Save the following example as a .mpl file.  From your file browser, double-click the .mpl file you created.

use Maplets in
   use Elements in
      maplet := Maplet(
         Window( 'title' = "Hilbert Matrix", [
            ["Dimension: ", TextField['TB1']( "10" )],
            ["Target format: ", DropDownBox['DDB1']( ["MATLAB",
             "MatrixMarket", "delimited"] )],
            ["File name:", TextField['TB2']( "hilmat" )],
            [
               Button( "OK", Shutdown(['TB1', 'DDB1', 'TB2']) ),
               Button( "Cancel", Shutdown() )
            ]
         ] )
      );
   end use;
   result := Display( maplet );
end use:
if result <> [] and result[3] <> "" then
   try
      n := parse( result[1] );
   catch:
   end try;
   if type( n, 'integer' ) then
      ExportMatrix(
         result[3],
         LinearAlgebra:-HilbertMatrix( n, outputoptions=[
         'datatype'=float[8]] ),
         'target' = convert( result[2], 'symbol' )
      );
   end if;
end if:

See Also

Maplets[Display]

Maplets[Elements]

Maplets[Examples]

Maplets[Tools]

MapletViewer

Overview of Maplet Applications