Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

cursor should not snap to invisible plots

Solved!
Go to solution

I've the same problem as Josh Moses and Albertz, but with Measurement Studio 8.5.

 

Is there a possibility to avoid cursors snap to invisible plots?

Christian
0 Kudos
Message 1 of 7
(4,214 Views)

Hello Christian,

 

One possibility would be to handle the BeforeMoveCursor event, and the check the BeforeMoveXYCursorEventArgs to see if the plot that the cursor is about to move to is visible, and cancel the event if it is not, similar to the following:

 

private void waveformGraph1_BeforeMoveCursor(object sender, BeforeMoveXYCursorEventArgs e)
{
    if (!e.Plot.Visible)
    {
        e.Cancel = true;
    }
}

 

Please let me know if that does not meet your needs!

 

NickB

National Instruments 

0 Kudos
Message 2 of 7
(4,191 Views)

Your suggestion works so far... but it easily leads to situations where the cursor seems to be locked. IMHO, this cannot be the true solution.

 

Christian

Christian
0 Kudos
Message 3 of 7
(4,174 Views)

Hello Christian,

 

I agree with you that under certain situations, this solution has some side effects that are less than desirable.  However, the current implementation of cursor snapping does not easily allow for a better solution.  This is some of the first  feedback we have heard regarding this issue,  and we certainly feel that you have raised a valid issue.  As such, I will be filing a corrective action request regarding this issue, so that this functionality can be provided in a future release.  

 

We have already considered a couple different scenarios for fixing this issue, and were interested if you, or anyone else reading this post, had any feelings one way or the other.  One possibility would be have a 'snapable' property on each plot, similar to the way that CVI handles this issue.  Also, we could remove any of the burden from the user, and simply never snap to invisible plots.  Another solution we have considered would be creating a collection of plots that a cursor could snap to when using the 'nearest point' method of snapping.  By default, the cursor would snap to all plots, until you specify plots in the cursor's collection, which would then be the only available plots for snapping for that cursor.  

 

Certainly don't feel pressured to respond, but we are very interested if you have an opinion one way or the other.  Once again, thanks for the feedback.

 

NickB

National Instruments

PS - I certianly do not consider this an official solution either, but another possible workaround would be to remove plots from the plot collection if they are invisible, and then store them in something like a list for when you need them upon making them visible again.  Because this cursor will try to snap to all plots in the graph's collection, this is the only true solution available now, although it is certainly somewhat messy.

Message 4 of 7
(4,171 Views)

Hi NickB

 

The 2nd solution would be very fine for us, as it implements our requirement without us needing to change one single line of code.

 

The 1st and 3d solution are also ok for us, and they are backwards compatible which might be important for other customers. From these 2 proposals, I'd vote for the first one.

 

Many thanks!

Christian
0 Kudos
Message 5 of 7
(4,148 Views)

Hello Christian,

 

I just thought I would let you know that I have submitted CAR 132782 to investigate this issue, and hopefully provide a solution in a later version of Measurement Studio.  Thanks again for your feedback, and for bringing it to our attention.

 

NickB

National Instruments 

Message 6 of 7
(4,133 Views)
Solution
Accepted by topic author Marrocco

Thank you for submitting the issue.

It works at least since version 2010. A Snappable property has been introduced.

 

I have a customized Plot class, so that I can implement the feature using this code.

 

protected override void OnPropertyChanged(PropertyChangedEventArgs e) {
	if (e.PropertyName == "Visible") {
		Snappable = Visible;
	}
	base.OnPropertyChanged(e);
} 

 It works like a charm!

Christian
0 Kudos
Message 7 of 7
(3,204 Views)