Hi I got an eventlistener to work (based on other threads in here) that check if the active viewport is changed or modified:
private void RunScript(ref object A)
{
A = "Test";
}
// <Custom additional code>
private RhinoView cachedActiveView;
public Script_Instance() //constructor
{
RhinoView.SetActive += OnViewSetActive;
RhinoView.Modified += OnViewModified;
}
// Handle the view set active event
private void OnViewSetActive(object sender, ViewEventArgs args)
{
cachedActiveView = args.View;
RhinoApp.WriteLine(">> RhinoView.SetActive");
owner.ExpireSolution(true);
// You can add more logic here as needed
}
// Handle the view modified event
private void OnViewModified(object sender, ViewEventArgs args)
{
if (args.View == cachedActiveView)
{
RhinoApp.WriteLine(">> RhinoView.Modified");
owner.ExpireSolution(true);
// You can add more logic here as needed
}
}
However. I wish to subscribe to an event that tracks when I’m zooming, panning etc in the active viewport. Is this possible.
EventListener.gh (4.5 KB)