09-09-2005 05:50 PM
09-12-2005 10:49 AM - edited 09-12-2005 10:49 AM
This may be a side effect of the cursor's snap mode. If you set XPosition, then set YPosition, XPosition may change when you set YPosition if the snap mode determines that the nearest point at YPosition is at a different XPosition. Try either A.) setting the SnapMode property to CursorSnapMode.Fixed or CursorSnapMode.Floating (depending on if you want the cursor to be interactive), or B.) setting the x/y positions simultaneously via the MoveCursor method. If neither of these suggestions resolve your problem, could you please post a small test project that reproduces the behavior that you're seeing? Thanks.
- Elton
Message Edited by Elton Wells on 09-12-2005 10:51 AM
09-12-2005 11:17 AM
I have lready tried your solutions and it didn't work . Any other suggestions ?
09-12-2005 11:25 AM
I forgot my requirements are that the SnapMode has to be seto "toPlot"
This are the settings for the Cursor number one , I have two cursor tied to the same plot, I will illustrate what happen with only one cursor this.xyCursor_1.Color = System.Drawing.Color.Yellow; this.xyCursor_1.HorizontalCrosshairMode = NationalInstruments.UI.CursorCrosshairMode.None; this.xyCursor_1.LabelXFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.Numeric, "F3"); this.xyCursor_1.LineStyle = NationalInstruments.UI.LineStyle.None; this.xyCursor_1.Plot = this.waveformPlot; this.xyCursor_1.PointSize = new System.Drawing.Size(9, 9); this.xyCursor_1.PointStyle = NationalInstruments.UI.PointStyle.SolidCircle; this.xyCursor_1.SnapMode = NationalInstruments.UI.CursorSnapMode.ToPlot; this.xyCursor_1.VerticalCrosshairMode = NationalInstruments.UI.CursorCrosshairMode.None; this.xyCursor_1.Visible = false; // -------------------------------------------------------------------------------------------------------------------------------------------------------This the method I call to set up the Cursors ant it fails randomly , with this I mean that sometimes the cursor succed changing position
and most of the time fails. I noticed though that if I call this method more than once with the some coordinates the cursor eventually get set.
public
void UpdateMarkers(double x1Data, double y1Data,double x2Data, double y2Data,bool enabeData){
xyCursor_1.XPosition = x1Data;
xyCursor_1.YPosition = y1Data;
xyCursor_2.XPosition = x2Data;
xyCursor_2.YPosition = y2Data;
if((x1Data==0 && y1Data ==0)||(x2Data==0 && y2Data ==0)){
xyCursor_1.Visible =
false;xyCursor_2.Visible =
false;waveformPlot.Visible =
false;waveformGraph.Enabled =
false;}
else{
xyCursor_1.Visible =
true;xyCursor_1.AfterMove +=
new AfterMoveXYCursorEventHandler(NiPotCurve_AfterMove);xyCursor_2.Visible =
true;xyCursor_2.AfterMove +=
new AfterMoveXYCursorEventHandler(NiPotCurve_AfterMove);waveformGraph.Invalidate();
}
}
09-12-2005 11:41 AM
Hi Elton,
I have to apologize but I come to know that I never tried one of the suggestions that you gave to me in the previous post.
I setup the cursor snap mode to fixed and everithingh worked , I remeber that Ihave tried snap mode to near point and it failed then toplot but I never tried fixed .
So for some reason using Fixed as a snap mode works and toPlot doesn't work anymore like the 7.0
Is there any reason for this?
The code I have is the some except the cursor snap mode.
Regards
Marcello Giannoni
09-12-2005 01:07 PM
09-12-2005 01:12 PM
Thank you Elton,
Yes this is my default case ,the cursor are not visible at the beginning .
I will update the code and see what happen .
Thank you again
09-12-2005 01:32 PM
Ok Elton ,
I have updated the code like you said and it definitly works , also I changed again the CursorSnap mode to back to "toPlot" like it was before and it works.
The problem ,like you said before, is definitly that when the cursor are not visible if I change the cursors coordinate , the cursors wont move; but if I set the cursor visibility to true and then I move the cursor the all thingh is working.
Thank you very much Elton this take a lot of thinghs off of my shoulder .
Regards
Marcello
public
void UpdateMarkers(double x1Data, double y1Data,double x2Data, double y2Data,bool enabeData){
if((x1Data==0 && y1Data ==0)||(x2Data==0 && y2Data ==0)){
xyCursor_1.Visible =
false;xyCursor_2.Visible =
false;waveformPlot.Visible =
false;waveformGraph.Enabled =
false;}
else{
xyCursor_1.Visible =
true;xyCursor_2.Visible =
true;xyCursor_1.XPosition = x1Data;
xyCursor_1.YPosition = y1Data;
xyCursor_2.XPosition = x2Data;
xyCursor_2.YPosition = y2Data;
xyCursor_1.AfterMove +=
new AfterMoveXYCursorEventHandler(NiPotCurve_AfterMove);xyCursor_2.AfterMove +=
new AfterMoveXYCursorEventHandler(NiPotCurve_AfterMove);}
}
09-12-2005 03:00 PM
Actually, it was Brock that posted the answer that solved your problem. I'm glad that things are working for you now.
- Elton
09-12-2005 03:04 PM
Ophs ! Thank you Broke and thank you Elton
Marcello