Property ActiveEdit
- Namespace
- Alternet.Editor.TextSource
- Assembly
- Alternet.Editor.v9.dll
ActiveEdit
Gets or sets an object that represent currently active (focused) ISyntaxEdit
control linked to the text source.
[Browsable(false)]
public virtual ISyntaxEdit ActiveEdit { get; set; }
Property Value
Examples
Here is how to use a ActiveEdit in the C# code:
using Alternet.Editor;
using Alternet.Editor.TextSource;
public partial class Form1 : Form
{
private TextSource textSource;
private void Form1_Load(object sender, EventArgs e)
{
var syntaxEdit1 = new SyntaxEdit(this.components);
var syntaxEdit2 = new SyntaxEdit(this.components);
textSource = new TextSource(this.components);
textSource.LoadFile("myfile.txt");
syntaxEdit1.Source = this.textSource;
syntaxEdit2.Source = this.textSource;
}
private void Button_Click(object sender, EventArgs e)
{
if (textSource.ActiveEdit != null)
textSource.ActiveEdit.Selection.SelectAll();
}
}
Here is how to use a ActiveEdit in the Visual Basic code:
Imports Alternet.Editor
Imports Alternet.Editor.TextSource
Partial Public Class Form1
Inherits Form
Private textSource As TextSource
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim syntaxEdit1 = New SyntaxEdit(Me.components)
Dim syntaxEdit2 = New SyntaxEdit(Me.components)
textSource = New TextSource(Me.components)
textSource.LoadFile("myfile.txt")
syntaxEdit1.Source = Me.textSource
syntaxEdit2.Source = Me.textSource
End Sub
Private Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
If textSource.ActiveEdit IsNot Nothing Then textSource.ActiveEdit.Selection.SelectAll()
End Sub
End Class
Remarks
One or more SyntaxEdit controls can edit the text stored in the TextSource object.
Use the ActiveEdit property to determine which of the SyntaxEdit controls associated with the source have an input focus.