Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Context Menu on CniGraph

Hello Venky,

Sure, that works too. There is no right and wrong. They do different things. One method resets a graph to what it was before it was zoomed. The other one sets the bounds of a graph to particular dimensions. If those dimensions happen to be what the dimensions were before you zoomed, then the final outcome is the same anyways. It is just a matter of style. How would you rather your program behave? The only problem I see with the second method is that you will have to change the constants every time your original size changes (if you ever do change it). But you could modify your program to store the starting values at the beginning and use those values later. I would personally use the first way because it is a lot less coding, but it is entirely up to you how you implement your project. You want to download the patch anyways to make sure that you are using the latest version of the controls anyways. Take care!


Regards,

Aaron B.
National Instruments
0 Kudos
Message 11 of 16
(1,900 Views)
Hi Aaron

Thanks for the quick reply. I did downloaded the patch and installed it too. I am able to see the property of the graphs, TrackModes with ZoomRectXYWithUndo and the rest, but i am not able to do so programmatically as per your suggest like..

m_Graph.TrackMode = (CNiGraph::GraphTrackModes)10;

As I had to right click on graph and then select the Reset Button, I did so but thrs no effect as per the above code. And to my surprise I am not able to see all the Track Mode Properties in NiGraph.h class. How do I get all the properties in the NiGraph.h file.

Thanks & regards
Venky
0 Kudos
Message 12 of 16
(1,901 Views)
Hello Venky,

If your approach does what you want it to do, then it is correct. If I were to try to accomplish the same thing, I would use the automatic undo-zooming feature because it is a lot easier (less code) and I would not have to figure out the original axes values. But there is no correct or incorrect answer.


Regards,

Aaron B.
National Instruments
0 Kudos
Message 13 of 16
(1,894 Views)
Hello Venky,

I tried attaching my project, but it was too large. You can find it at ftp.ni.com/outgoing. It is contained in a zip file called, Zooming.zip. Open the project in the zip file. Click on the "ZoomRectXY" button. Zoom in on the graph. To undo, hold down shift and left-click on the graph. Please let me know if this does not work. Take care!


Regards,

Aaron B.
National Instruments
0 Kudos
Message 14 of 16
(1,881 Views)
Hi Aaron

Thanks for the extended support. I am able to handle as per your suggestion. And I do prefer doing as per your suggestion. As it really reduces the coding part. And I do have some other query too..

1) I did installed the patch for Measurement Studio 6.0 and I am able to see the properties of the Graph control, in the "Graph" Property page I can see the Track Modes with multiple options but I am not able to find all these Track Modes in "NiGraph.h" header file. Do I need to added them separately?

Do suggest me on this.

Thanks & Regards
Venky
0 Kudos
Message 15 of 16
(1,879 Views)
Hello Venky,

Sorry for not addressing that second question. The answer is, yes, you should be able to see them in the property page, but it is not defined in the file NiGraph.h. If you add the type definition in, you will be able to use it in your code.

I modified NiGraph.h so it looks like:

...
TrackZoomRectY = 8,
// Positions annotations with the mouse.
TrackDragAnnotation = 9,

// Aaron Added
TrackZoomRectXYUndo = 10
};
....

Then, I can use the constant, TrackZoomRectXYUndo in my code. Hope this helps. Take care!


Regards,

Aaron B.
National Instruments
0 Kudos
Message 16 of 16
(1,872 Views)