Text Navigation

The EditControl offers extensive support for text navigation. You can perform navigation at the character, word, line, page, or entire document levels. This section briefly explains navigation of text in the EditControl.

Syntax editor with navigation options by character, word and line

Character based navigation

The following functions enables text navigation in the EditControl in terms of characters or columns.

Functions Description

MoveUp

Moves cursor up, if possible.

MoveDown

Moves cursor down, if possible.

MoveLeft

Moves cursor left, if possible.

MoveRight

Moves cursor right, if possible.
this.editControl1.MoveUp();

this.editControl1.MoveDown();

this.editControl1.MoveLeft();

this.editControl1.MoveRight();
Me.editControl1.MoveUp()

Me.editControl1.MoveDown()

Me.editControl1.MoveLeft()

Me.editControl1.MoveRight()

Word based navigation

The following functions enables text navigation in the EditControl in terms of words.

Functions Description

MoveLeftWord

Moves caret to the left by one word.

MoveRightWord

Moves caret to the right by one word.
this.editControl1.MoveLeftWord();

this.editControl1.MoveRightWord();
Me.editControl1.MoveLeftWord()

Me.editControl1.MoveRightWord()

Line based navigation

The following functions enables text navigation in the EditControl in terms of lines.

Functions Description

MoveToLineStart

Moves caret to the beginning of the line. First whitespace will be skipped.

MoveToLineEnd

Moves caret to the end of the line.
this.editControl1.MoveToLineStart();

this.editControl1.MoveToLineEnd();
Me.editControl1.MoveToLineStart()

Me.editControl1.MoveToLineEnd()

Page based navigation

The following functions enables text navigation in the EditControl in terms of pages.

Functions Description

MovePageUp

Moves caret one page up.

MovePageDown

Moves caret one page down.
this.editControl1.MovePageUp();

this.editControl1.MovePageDown();
Me.editControl1.MovePageUp()

Me.editControl1.MovePageDown()

Block based navigation

Position the keyboard cursor at the beginning and end of the indentation block by using the JumpToIndentBlockStart and JumpToIndentBlockEnd functions respectively.

this.editControl1.JumpToIndentBlockStart();

this.editControl1.JumpToIndentBlockEnd();
Me.editControl1.JumpToIndentBlockStart()

Me.editControl1.JumpToIndentBlockEnd()

Document based navigation

The following functions enables text navigation in the EditControl in terms of documents.

Functions Description

MoveToBeginning

Moves caret to the beginning of the file.

MoveToEnd

Moves caret to the end of the file.
this.editControl1.MoveToBeginning();

this.editControl1.MoveToEnd();
Me.editControl1.MoveToBeginning()

Me.editControl1.MoveToEnd()

Retrieve current word

Retrieves the current word in the EditControl by using the GetCurrentWord function.

Console.WriteLine(this.editControl1.GetCurrentWord().ToString());
Me.WriteLine(this.editControl1.GetCurrentWord().ToString())

Retrieve current column index in line

Retrieves the current word column index in the EditControl by using the GetCurrentWordColumn function and CurrentColumn property.

Console.WriteLine(this.editControl1.GetCurrentWordColumn().ToString());

Console.WriteLine(this.editControl1.CurrentColumn);
Me.WriteLine(this.editControl1.GetCurrentWordColumn().ToString())

Me.WriteLine(this.editControl1.CurrentColumn)

Retrieve current line index

Retrieves the current word column index in the EditControl by using the CurrentLine property.

Console.WriteLine(this.editControl1.CurrentLine);
Me.WriteLine(this.editControl1.CurrentLine)

NOTE

Refer to the following sample link that demonstrates the text navigation functionalities in the EditControl:
C:\Users\<User>\AppData\Syncfusion\EssentialStudio\Version Number\Windows\Edit.Windows\Samples\Text Navigation\Text Navigation

Scrolling

The EditControl offers extremely smooth scrolling behavior by using the idle-time processing and dynamic scroll area expansion techniques. The scrolling behavior is smooth even when loading large files though the EditControl scrolls by several hundred lines for a small movement of the scroller.

The scrollers in the EditControl can be optionally shown or hidden by using the following properties.

Properties Description

ShowVerticalScroller

Specifies a value indicating whether the vertical scroller can be shown or not.

ShowHorizontalScroller

Specifies a value indicating whether the horizontal scroller can be shown or not.

AlwaysShowScrollers

Specifies a value indicating whether scrollers should always be visible or not.
// Display the Horizontal Scroller.

this.editControl1.ShowHorizontalScroller = true;

// Display the Vertical Scroller.

this.editControl1.ShowVerticalScroller = true;

this.editControl1.AlwaysShowScrollers = true;
// Display the Horizontal Scroller.

Me.editControl1.ShowHorizontalScroller = True

// Display the Vertical Scroller.

Me.editControl1.ShowVerticalScroller = True

Me.editControl1.AlwaysShowScrollers = True

Supports scroller events that are raised when the scroll arrows are clicked. The scroller events are used to synchronize the scrolling of multiple EditControls.

Horizontal and vertical scrollers in syntax editor

Scroll position and offsets

The scroll position and offsets of the EditControl are set by using the following properties.

Properties Description

ScrollPosition

Specifies scroll position of the EditControl.

ScrollOffsetBottom

Specifies the bottom scroll offset.

ScrollOffsetLeft

Specifies the left scroll offset.

ScrollOffsetRight

Specifies the right scroll offset.

ScrollOffsetTop

Specifies the top scroll offset.
this.editControl1.ScrollPosition = new Point(1, 5);

this.editControl1.ScrollOffsetBottom = 5;

this.editControl1.ScrollOffsetLeft = 10;

this.editControl1.ScrollOffsetTop = 5;

this.editControl1.ScrollOffsetTop = 10;
Me.editControl1.ScrollPosition = New Point(1, 5) 

Me.editControl1.ScrollOffsetBottom = 5 

Me.editControl1.ScrollOffsetLeft = 10 

Me.editControl1.ScrollOffsetTop = 5 

Me.editControl1.ScrollOffsetTop = 10