Hi Roger,
Please try the following code, I have added comments for the key lines.
void goToSourceWindow() {
GraphLayer gl = Project.ActiveLayer();
if(!gl) {
out_str("Please Activate A Graph!");
return;
}
DataPlot dp = gl.DataPlots(0); // get first data plot in layer
if(!dp) {
out_str("No Data Plot In Graph Layer!");
return;
}
DataRange dr;
dp.GetDataRange(dr); // get data range of the plot
MatrixLayer ml; // source matrix layer
int c1, c2; // matrix object index
dr.GetRange(ml, c1, c2); // get the source matrix layer
set_active_layer(ml); // set the matrix layer active
ml.SetActive(c1); // set the matrix object active
}
Penn