From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI graph axis update only when panel is active, but waveform update is done in inactive panel

Solved!
Go to solution

Hello,

 

i have got a problem when i want to save a panel screenshot with the functions GetPanelDisplayBitmap & SaveBitmapToPNGFile. The panel screenshot is done when panel is hidden or inactive. So some drawing events won't be done.

 

Please have a look into the attached screenshots:

 

1) manual measurement and saving operation, saved data is ok

2) hidden measurement and saving operation, saved data is not ok, the axis had not beend updated

3) bring the panel in front, axis had been updated

 

Is it possible to force a axis update without bringing the panel in front or set it as active panel?

 

Best regards,

Vitali

 

1)

first_measurement.PNG

 

2)

second_measurement_axis_not_updated.png

 

3)

second_measurement_updated_axis.PNG

0 Kudos
Message 1 of 16
(4,287 Views)

Hi Vitali,

 

by "axis update" do you mean a graph refresh? (in your figures 1 and 2 the axes are identical)

 

Are you calling RefreshGraph / what is the value of ATTR_REFRESH_GRAPH?

 

 

I am not sure if I understood you correctly but you can update the graph on your panel without bringing the panel to front. For a smooth update, I hide the graph control, make all required changes, and display it again...

0 Kudos
Message 2 of 16
(4,267 Views)

Hello Wolfgang,

 

thank you for your reply.

 

You see my problem: ..."in your figures 1 and 2 the axes are identical"..

 

In figure 2 the axes had not been updated. It is the axes information from figure 1 with the new data. In figure 3 you see the right axes for figure 2 after bringing the panel to front.

 

The function RefreshGraph does not update the axes when the panel is in background. This is my problem. I am woundering, why only the data is refreshed.

0 Kudos
Message 3 of 16
(4,264 Views)

The software works in an automatic mode. So i don't want to show the panels in this mode. All actions will be done in background. The panel will be displayed only when the tester wants to observe what is happening in this module. The main application includes several modules with several panels.

0 Kudos
Message 4 of 16
(4,263 Views)

Maybe i found my problem:

 

- my module uses following function before plotting the measured data points in the graph control and saving the panel screenshot:

   - SetCtrlAttribute (panel, PANEL_GRAPH, ATTR_VISIBLE, 0);

   - PlotWaveform

   - SetCtrlAttribute (panel, PANEL_GRAPH, ATTR_VISIBLE, 1);

   - ...

   - Get panel bitmap and save bitmap to png

 

I can reproduce the behaviour with following example:

 

0 Kudos
Message 5 of 16
(4,236 Views)

To reproduce the behaviour do following steps:

 

1) change number of samples per channel

2) click on Acquire

3) minimize the panel

4) wait until the screenshot is saved (change the path and filename in line number 169 in function SaveBitmapToPNGFile before)

5) compare the panel and the screenshot

 

0 Kudos
Message 6 of 16
(4,236 Views)

Have you tried adding a ProcessDrawEvents or ProcessSystemEvents call just before the GetPanelDisplayBitmap call?

0 Kudos
Message 7 of 16
(4,205 Views)

Yes, this does not help.

 

I found a solution. Before printing of any data points in the graph, you have to change the z-plane order and bring the control on the panel to the front. The panel can be hidden. Then the axes will be updated.

0 Kudos
Message 8 of 16
(4,202 Views)
Solution
Accepted by topic author vitali_R

I think this is a bug of cvi.

 

This is how it works:

 

- SetCtrlAttribute (panel, control, ATTR_ZPLANE_POSITION, 0);  //without this step the axes won't be updated!!!!!!!

- for each channel { PlotWaveform(..); }

- ...

0 Kudos
Message 9 of 16
(4,201 Views)

If you don't do the z-plane trick and you put a breakpoint just before calling GetPanelDisplayBitmap, I assume the axes haven't beeen updated yet. But, if while your program is suspended at the breakpoint, you select Run>>Refresh User Interface, do they not update at that point? And if so, will the contents returned by GetPanelDisplayBitmap have those updates?

0 Kudos
Message 10 of 16
(4,184 Views)