DocumentTools[Components] - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Document Tools : Components : DocumentTools/Components/CodeEditRegion

DocumentTools[Components]

  

CodeEditRegion

  

generate XML for a CodeEditRegion Component

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

CodeEditRegion(str, opts)

Parameters

str

-

(optional) string; string of code statements.

opts

-

(optional) ; one or more keyword options as described below

Options

• 

autoexpand : truefalse; Indicates whether the component will expand automatically. The default is true.

• 

expanded : truefalse; Indicates whether the component is expanded. The default is true.

• 

height : posint; The height in pixels of the component. The default value is 200.

• 

identity : {name,string}; The reference name of the component.

• 

linenumbers : truefalse; Indicates whether the code is annotated with line numbers. The default is true.

• 

showborders : truefalse; Indicates whether the component's borders are shown. The default is true.

• 

visible : truefalse; Indicates whether the component is visible. The default is true.

• 

width  : posint; The width in pixels of the component. The default value is 500.

Description

• 

The CodeEditRegion command in the Component Constructors package returns an XML function call which represents a CodeEditRegion Component.

• 

The generated XML can be used with the results of commands in the Layout Constructors package to create an entire Worksheet or Document in XML form. Such a representation of a Worksheet or Document can be inserted into the current document using the InsertContent command.

Examples

withDocumentTools:

withDocumentTools:-Components:

withDocumentTools:-Layout:

sx := 4;

sx := 4;

(1)

Executing the CodeEditRegion command produces a function call.

CCodeEditRegions,identity=CodeEditRegion0

C_XML_CodeEditor-ExecGroupview=presentation,applyint=false,applyrational=false,display=code,_XML_EC-CodeEditorid=CodeEditRegion0,pixel-width=500,pixel-height=200,autoexpand=true,expanded=true,visible=true,code-line-numbers=true,wrapping=false,show-border=true,x := 4;

(2)

By using commands from the DocumentTools:-Layout package a nested function call can be produced which represents a worksheet.

xmlWorksheetC:

That XML representation of a worksheet can be inserted directly.

InsertContentxml:

 

The previous example's call to the InsertContent command inserted a component with identity "CodeEditRegion0", which still exists in this worksheet. Inserting additional content whose input contains another component with that same identity "CodeEditRegion0" incurs a substitution of the input identity in order to avoid a conflict with the identity of the existing component.

The return value of the following call to InsertContent is a table which can be used to reference the substituted identity of the inserted component.

C := CodeEditRegion( s, identity = "CodeEditRegion0",
                        width = 400, height = 300, linenumbers=false,
                        showborders = false );

C_XML_CodeEditor-ExecGroupview=presentation,applyint=false,applyrational=false,display=code,_XML_EC-CodeEditorid=CodeEditRegion0,pixel-width=400,pixel-height=300,autoexpand=true,expanded=true,visible=true,code-line-numbers=false,wrapping=false,show-border=false,x := 4;

(3)

xml := Worksheet( C ):

lookup := InsertContent(xml, output=table);

lookuptableCodeEditRegion0=CodeEditRegion1

(4)

 

lookup["CodeEditRegion0"];

CodeEditRegion1

(5)

GetProperty( lookup["CodeEditRegion0"], value );

x := 4;

(6)

 

Compatibility

• 

The DocumentTools:-Components:-CodeEditRegion command was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

• 

The DocumentTools:-Components:-CodeEditRegion command was updated in Maple 2017.

• 

The expanded option was introduced in Maple 2017.

• 

The visible option was updated in Maple 2017.

• 

For more information on Maple 2017 changes, see Updates in Maple 2017.

See Also

Component Code

Component Constructors

DocumentTools

Embedded Components

Layout Constructors

XMLTools