Ellié Computing Home Page
My Shopping Cart

Your shopping cart is empty

Display Cart

Call us at +1 586 62 ELLIE / +1 586 62 35543 Office Opened
sales@elliecomputing.com - Contact us


TextDocument.View object

 

 

Prototype for TextDocument.View objects. Is a kind of View object.

Syntax

You cannot create View object directly. Views are created as necessary when DocumentFrame  objects are created for a document.

var my_doc;
var doc_frame = add_frame (my_doc);
var left_view = doc_frame.coordinator.views.left;

Parameters

none.

Property Of

none.

Implemented In

ECMerge 2.1

Description

TextDocument.View objects let you navigate by character position, obtain the selection or set it.

Properties

none specific.

Methods

clone_selection
navigate
set_selection

Examples

Example 1.

Set the selection on current view to the whole content.

current_frame.coordinator.current_view.set_selection (new TextDocument.Selection (current_frame.coordinator.document.content.left);

See Also 

  View object, DocumentFrame  object

 

Method clone_selection

Syntax

function clone_selection ( )
returns a TextDocument.Selection object.

Parameters

none.

Method Of

TextDocument.View object

Implemented In

ECMerge 2.1

Description

Returns a new selection object which contains the same characters as those selected in the view.

Examples

Example 1.

Retrieves the selection of the current view:

current_frame.coordinator.current_view.clone_selection();

See Also 

  TextDocument.View object, TextDocument.Selection object

Method navigate

Syntax

function navigate (position)

Parameters

position. Integer. Character position in the given view

Method Of

TextDocument.View object

Implemented In

ECMerge 2.1

Description

Set the cursor position to the given position, and ensures that it is visible in the view.

Examples

Example 1.

Navigate to the start of 10 th line:

var current_doc = current_frame.coordinator.document;
current_doc.root.children.fill ();
current_frame.coordinator.current_view.navigate ( current_doc.content[current_frame.coordinator.current_view.role].position_from_line (10) );

See Also 

  TextDocument.View object

Method set_selection

Syntax

function set_selection (selection)

Parameters

selection. TextDocument.Selection object. Selection to set on the view

Method Of

TextDocument.View object

Implemented In

ECMerge 2.1

Description

Selects in the view exactly the same characters as those included in selection.

Examples

Example 1.

Builds a selection containing all the text of the , then set it on the view (actually selecting all items):

var current_doc = current_frame.coordinator.document;
var side = current_frame.coordinator.current_view.role;
var sel = new TextDocument.Selection (current_doc.content[side], LinearRange(0, current_doc.content[side].length));

current_frame.coordinator.current_view.set_selection (sel);

See Also 

  TextDocument.View object, TextDocument.Selection object