Class Locals
Displays and evaluates local variables during script debugging.
[ToolboxBitmap(typeof(Locals), "Images.Locals.Icon.bmp")]
public class Locals : VariablesEvaluationControlBase, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IContainerControl
- Inheritance
-
Locals
- Implements
Examples
Here is how to declare a Locals and handle its events from the C# code:
using Alternet.Scripter.Debugger;
using Alternet.Scripter.Debugger.UI;
public partial class Form1 : Form
{
private void Form1_Load(object sender, EventArgs e)
{
var debugger = new ScriptDebugger();
var localsControl = new Locals();
localsControl.Dock = System.Windows.Forms.DockStyle.Fill;
localsControl.Debugger = debugger;
localsControl.AddToWatchClick += LocalsControl_AddToWatchClick;
}
private void LocalsControl_AddToWatchClick(object sender, AddToWatchClickEventArgs e)
{
if (!string.IsNullOrEmpty(e.Expression))
{
System.Windows.Forms.MessageBox.Show(e.Expression);
}
}
}
Here is how to declare a Locals and handle its events from the Visual Basic code:
Imports System
Imports Alternet.Scripter.Debugger
Imports Alternet.Scripter.Debugger.UI
Partial Public Class Form1
Inherits Form
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim debugger = New ScriptDebugger()
Dim localsControl = New Locals()
localsControl.Dock = Windows.Forms.DockStyle.Fill
localsControl.Debugger = debugger
AddHandler localsControl.AddToWatchClick, AddressOf LocalsControl_AddToWatchClick
End Sub
Private Sub LocalsControl_AddToWatchClick(ByVal sender As Object, ByVal e As AddToWatchClickEventArgs)
If Not String.IsNullOrEmpty(e.Expression) Then
Windows.Forms.MessageBox.Show(e.Expression)
End If
End Sub
End Class
Remarks
Locals is a visual control used to examine values of local variables when debugging code step-by-step.
The most important properties of the Locals are:
The Debugger property specifies the ScriptDebugger instance, which local variables are displayed and evaluated by the Locals control.
The SelectedWatch property represents the currently selected watch expression.
Constructors
- Locals()
Initializes a new instance of the
Locals
class with default settings.
Fields
Properties
- SelectedText
Gets a currently selected text.
- SelectedWatch
Gets a currently selected watch expression.
Methods
- Dispose(bool)
Clean up any resources being used.
- EvaluateVariables(IEnumerable<string>)
Evaluates values of given variables asynchronously.
- Localize()
Localizes string resources.
Events
- AddToWatchClick
Occurs when a user clicks on the local to add it to the watch window.