LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

debugging xy graphs

Solved!
Go to solution

Peter:

 

Two questions about your response:

 

1. Why do you need to explicitly use the value of the constant for panel ID instead of using the name of the global variable?

In the CVI 9.0.1 help for Interactive Window Execution, it states "The Interactive Execution window can access functions and data declared as global in a Source window".  I have not been able to get the Interactive Execution Window to recognize globals in the program I'm debugging.

 

2. You say that you should be able to run the function panel for GetPlotAttribute directly, but GetPlotAttribute returns the attribute value by reference, using a pointer to the variable to contain the attribute value.  How do you do that when you're running the function panel directly?

 

Thanks

0 Kudos
Message 11 of 13
(1,051 Views)

Hello Al,

 

1. Sometimes the panel handle is declared 'static' and you cannot access it from another file or from the interactive window. If your panel handle is declared without 'static' then you can access it through extern:

 

 

#include <userint.h>
#include "graphs.h"
static int axis;
extern int handle;
GetPlotAttribute(handle, PANEL_GRAPH,
    1 /* your plot id */, ATTR_PLOT_YAXIS, &axis);

 

 

 (The example is based on samples/userint/graphs.prj when you're suspended in PlotData.)

 

2. You have to declare a variable for the output parameter. Open the function panel for GetPlotAttribute and put the text cursor into the Attribute Value field. Then select Code >> Declare Variable... or press Ctrl+D. Type in a name, select Execute declaration in Interactive Window, deselect the other two options and OK. Fill in the other fields and you can run the function panel.

 

Regards,

 

Peter

Message 12 of 13
(1,045 Views)

Peter:

 

1. Yes, you found my problem with the global: it was declared static.  I didn't have a clear understanding of how the interactive execution window interacted with the source file code in my project, but static globals being accessible only in the file in which they are declared is right out of K&R.  Thanks for the reminder.

 

2. That's very cool!  I never realized the connection between function panel execution and the immediate execution window.  That will continue to come in handy.

 

Thanks!

0 Kudos
Message 13 of 13
(1,040 Views)