Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

no cwgraph plotmousedown event close to cursor position

The plotmousedown event is not raised when clicking in the the vicinity of a cursor. How can I detect that the user has clicked on a plot when the point is near a cursor?
0 Kudos
Message 1 of 9
(7,437 Views)
You may want to try the CursorMouseDown event instead of the PlotMouseDown event. Also, make sure that you have the right track mode set. For example, go to the property pages, then go to the graph tab, and set the "Track mode" option to "Plot & Cursor Events."

- Elton
0 Kudos
Message 2 of 9
(7,437 Views)
Thanks for your help. However, the CursorMouseDown event gives you x,y values of the cursor, not the nearest plot values.
0 Kudos
Message 3 of 9
(7,437 Views)
Hello goldstand,

I tried to replicate the problem that you are experiencing using the PlotMouseDown event with the CWGraph, but thus far I was unsuccessful. I was able to successfully call a PlotMouseDown event on a CWGraph when I was clicked on a plot where the point was near the cursor. Therefore in order for me to replicate this issue, I think I am going to need more information from you.

1) What version of Measurement Studio are you using and what programming environment are you using?

2) What track mode is set on your CWGraph? I was able to accomplish this by setting the track mode to track all events.

3) What is the snap mode of the cursor that you are using?

Also, if you could create a small example which demonstrates t
his behavior and attach it to this page; I would like to take a look at it in order to replicate the issue.

Regards,
Kevin Leonard
Applications Engineer
National Instruments
0 Kudos
Message 4 of 9
(7,437 Views)
I am using Measurement Studio for VB version 6. A good sample of my problem can be found in NI's example program Measurement Studio 2D Graph Events in Visual Basic .NET (http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3E1B556A4E034080020E74861&p_node=DZ52138&p_submitted=N&p_rank=&p_answer=&p_source=External)
As stated in the NI tutorial, "Interacting with Measurement Studio Graphs in Visual Basic", for trackmode Plot & Cursor Events (cwGTrackAllEvents) the control generates the events in the following order:
1. CursorMouse event (if the mouse is near a cursor)
2. PlotMouse event (if the mouse is near a plot)
3. PlotAreaMouse event
You only get one event when you click, depending where you click, accordi
ng to the priority above. Using the example program above, position the cursor very close to a peak in the graph. You may get only CursorMouseDown and not PlotMouseDown.

I would like to do one of the following:
1. Mask out CursorMouse event so I can see the PlotMouse event
or
2. Use the value returned by PlotMouseDown do determine if the mouse is near a plot and if so get the value of the plot.

How can I do this?
0 Kudos
Message 5 of 9
(7,437 Views)
Sorry, the last sentence should be:

2. Use the value returned by CursorMouseDown to determine if the mouse is near a plot and if so get the value of the plot.
0 Kudos
Message 6 of 9
(7,437 Views)
One additional point: If you add a second cursor and place them close together (e.g one cursor at Y=1, the other at Y=2), you only get Cursor events within this band - no Plot or PlotArea events.
0 Kudos
Message 7 of 9
(7,437 Views)
Hello goldstand,

First, I was wondering if you could clarify if you are using VB 6 or VB.NET, because the example you attached was in VB.NET. Second, when I selected the TrackMode for the CWGraph to be cwGTrackAllEvents, I was able to get all three of the events (CursorMouse, PlotMouse, and PlotAreaMouse) to execute. The article that you referenced was stating that those three events will happen in a deterministic order, but all three events should happen. I also am attaching a screen shot of the example that you attached which shows both the CursorMouse and PlotMouse events executing. When this screen shot was taken, I was clicking where the cursor was intersected the plot.

I believe why I am
seeing one behavior of the CWGraph and you are seeing another may be to do the version of the controls that we are using. Therefore, if you are using the Measurement Studio 6 controls, there is a free update to get the 7.1 version of the ActiveX controls. This can be found at the following website.

http://digital.ni.com/softlib.nsf/websearch/2AAC97491D073A6C86256EEF005374CE?opendocument&node=132070_US

I would install this update and see if you can get all three of the CWGraph events to execute.

Regards,
Kevin Leonard
Applications Engineer
National Instruments
0 Kudos
Message 8 of 9
(7,439 Views)
Updating to version 7.1 indeed fixed the problem. Thanks so much for your help.
0 Kudos
Message 9 of 9
(7,430 Views)