Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

CNiGraph and multiple plots

When passing a CNiGraph object to another function by reference or pointer, does the object retain its properties that were created in design time, or the receving function will create a brand new copy of the passing object (not likely)? I ask this question is because I keep getting invalid index when I try to do multiple plots. I have created 10 plots at design time but getting zero when I query by using plots.count in the receiving function.

calling code:

Plot(&myCNiGraph, dataArray);

receving code:
void CPlotData::Plot(CNiGraph *Mygraph, double *data)
{
CString str;
str.Format("Number of plots %d", Mygraph.Plots.Count);
// This line always show zero plot
MyGraph.Caption = str
;
// will get invalid index error msg here when calls Plot
CNiReal64Vector wfm(datalen, data);
MyGraph.Plots.Item(MyPlotName).Plot(wfm);
}

Any ideas? Thanks.
0 Kudos
Message 1 of 3
(3,243 Views)
The object should retain its settings when passed by reference or pointer. The behavior that you're seeing is likely an issue with the persistence of the settings at design-time rather than an issue with how the object is passed. Are you using Visual C++ 6.0 or Visual C++ .NET? If the latter, this is a known issue that is documented in the Measurement Studio 6.0 for Visual C++ .NET README:

"In Visual C++ .NET, the Measurement Studio 3D Graph and User Interface controls do not update correctly when you modify the property pages after running the program. When you use the property pages to change a property after running the program, and compile and run the program again, the property change does not take effect. To work around this issue, make the change in t
he property pages, move the control on the dialog resource, and move the control back to its original position on the dialog resource. Alternatively, close the resource editor after modifying the property pages and before running the program, and reopen the resource editor. When you run the program, the control appears with the updated property."

- Elton
0 Kudos
Message 2 of 3
(3,243 Views)
I am using VC6 with sp5. I ended up creating the plots programmatically. I am still trying to figure out what went wrong with the settings. Thanks for your response.
0 Kudos
Message 3 of 3
(3,243 Views)