11-03-2008 07:43 AM
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?
Solved! Go to Solution.
11-06-2008 10:05 AM
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
11-07-2008 07:53 AM
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
11-07-2008 08:51 AM
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.
11-10-2008 01:56 AM
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!
11-10-2008 05:05 PM
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
07-13-2011 07:55 AM
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!