LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

[Problem] Updating Numeric Controls on a Tab Problem

Using LabWindows CVI 8.0.1

 

I have a UIR with a button on it and a tab control.  On the tab control there are 23 numeric controls.

 

When the button is pressed the code reads a file and populates an array.  It then populates 23 controls on the tab.

 

I have a constant array defined for the controls.  The button call back gets the panel handle and then loops through each control and populates it from the array of values.

 

The problem I am seeing is if I click the button 22 of the controls update, the first one does not.  If I save the data (another button) it saves the values which are loaded (i.e. it knows the first control contains a value even though it is displaying 0.000). 

 

If I click the button twice, then all 23 controls update.

 

I added ProcessDrawEvents and ProcessSystemEvents but it made no difference.  However if, in my code I modified the callback to call the function that populates the tab controls twice it populates all 23 controls correctly first time. 

 

Is this a known issue, or has anyone seen this before?

 

Should mention that the code is compiled as a DLL and is called via TestStand 3.5.  It makes use of #include "tsutil.h" library.  There is also a ActiveX control on the UIR (not on the tab) which is a date picker.

Christopher Povey

Principle Test Systems Engineer for BAE Systems.
0 Kudos
Message 1 of 5
(3,557 Views)

Can you post the code for the loop that updates the controls? This sounds very much like there is some variable declared outside the loop that is modified in the loop, but is not initialized properly. Also, are you error checking the call that updates each control? Can you confirm that it returns 0 on the first iteration?

 

Mert A.

National Instruments

0 Kudos
Message 2 of 5
(3,547 Views)

Global:

 

#define NumberOfCrosses 23
...

const int CrossCtrlAzimuthHandles [NumberOfCrosses]   = { CROSSPOSN_X_CROSS_1,  CROSSPOSN_X_CROSS_2,  CROSSPOSN_X_CROSS_3,  CROSSPOSN_X_CROSS_4,  CROSSPOSN_X_CROSS_5, 
                             CROSSPOSN_X_CROSS_6,  CROSSPOSN_X_CROSS_7,  CROSSPOSN_X_CROSS_8,  CROSSPOSN_X_CROSS_9,  CROSSPOSN_X_CROSS_10,
                             CROSSPOSN_X_CROSS_11, CROSSPOSN_X_CROSS_12, CROSSPOSN_X_CROSS_13, CROSSPOSN_X_CROSS_14, CROSSPOSN_X_CROSS_15,
                             CROSSPOSN_X_CROSS_16, CROSSPOSN_X_CROSS_17, CROSSPOSN_X_CROSS_18, CROSSPOSN_X_CROSS_19, CROSSPOSN_X_CROSS_20,
                             CROSSPOSN_X_CROSS_21, CROSSPOSN_X_CROSS_22, CROSSPOSN_X_CROSS_23 };

const int CrossCtrlElevationHandles [NumberOfCrosses] = { CROSSPOSN_Y_CROSS_1,  CROSSPOSN_Y_CROSS_2,  CROSSPOSN_Y_CROSS_3,  CROSSPOSN_Y_CROSS_4,  CROSSPOSN_Y_CROSS_5, 
                             CROSSPOSN_Y_CROSS_6,  CROSSPOSN_Y_CROSS_7,  CROSSPOSN_Y_CROSS_8,  CROSSPOSN_Y_CROSS_9,  CROSSPOSN_Y_CROSS_10,
                             CROSSPOSN_Y_CROSS_11, CROSSPOSN_Y_CROSS_12, CROSSPOSN_Y_CROSS_13, CROSSPOSN_Y_CROSS_14, CROSSPOSN_Y_CROSS_15,
                             CROSSPOSN_Y_CROSS_16, CROSSPOSN_Y_CROSS_17, CROSSPOSN_Y_CROSS_18, CROSSPOSN_Y_CROSS_19, CROSSPOSN_Y_CROSS_20,
                             CROSSPOSN_Y_CROSS_21, CROSSPOSN_Y_CROSS_22, CROSSPOSN_Y_CROSS_23  };
                             
const int CrossCtrlDistortionTolerancesHandles [NumberOfCrosses] = { DISTTOL_TOL_CROSS_1,  DISTTOL_TOL_CROSS_2,  DISTTOL_TOL_CROSS_3,  DISTTOL_TOL_CROSS_4,  DISTTOL_TOL_CROSS_5,
                                   DISTTOL_TOL_CROSS_6,  DISTTOL_TOL_CROSS_7,  DISTTOL_TOL_CROSS_8,  DISTTOL_TOL_CROSS_9,  DISTTOL_TOL_CROSS_10,
                                   DISTTOL_TOL_CROSS_11, DISTTOL_TOL_CROSS_12, DISTTOL_TOL_CROSS_13, DISTTOL_TOL_CROSS_14, DISTTOL_TOL_CROSS_15,
                                   DISTTOL_TOL_CROSS_16, DISTTOL_TOL_CROSS_17, DISTTOL_TOL_CROSS_18, DISTTOL_TOL_CROSS_19, DISTTOL_TOL_CROSS_20,
                                   DISTTOL_TOL_CROSS_21, DISTTOL_TOL_CROSS_22, DISTTOL_TOL_CROSS_23 };
...

 

Function:

 

 // Get the panel handles.
 tsErrChk (GetPanelHandleFromTabPage (panelHandle, MAIN_PANEL_TAB, 0, &calibrationTabHandle));
 tsErrChk (GetPanelHandleFromTabPage (panelHandle, MAIN_PANEL_TAB, 1, &tolerancesTabHandle));
 
 // Get the cross positions.
 for (loop = 0; loop < NumberOfCrosses && error >= 0; loop++)
 {
  tsErrChk (SetCtrlVal (calibrationTabHandle, CrossCtrlAzimuthHandles   [loop],            calibrationValues.crossAzimuthPosition      [loop]));
  tsErrChk (SetCtrlVal (calibrationTabHandle, CrossCtrlElevationHandles [loop],            calibrationValues.crossElevationPosition    [loop]));
  tsErrChk (SetCtrlVal (tolerancesTabHandle,  CrossCtrlDistortionTolerancesHandles [loop], calibrationValues.crossDistortionTolerances [loop]));
 }

 

No errors are returned to TestStand.

Christopher Povey

Principle Test Systems Engineer for BAE Systems.
0 Kudos
Message 3 of 5
(3,537 Views)

Well that all looks fine. You said that the update only appears to update 22 of the 23 controls, but you have 23 x 3 numerics. Just to clarify, is it one or three numeric controls that fail to visually update?

 

Also, I think you made a point that I had glossed over. After having loaded values, when the first control is showing the wrong value (i.e. 0.00), you can save the loaded values and the first control gives you the correct value? In other words, you're seeing that the actual stored value and the displayed value of that numeric are inconsistent?

 

The only thing I can think to suggest is incrementally simplifying your UI and seeing how far you can go before the problem stops occurring. For example, you might try removing other controls besides the button, numerics, and tab. Or you could try moving the controls onto a single tab page, or even onto the main panel, getting rid of the tab control entirely. You might try updating only one or two numerics during a load. If you can narrow it down to a simple change that makes the problem go away, that should give us a good idea where the root of the problem lies.

 

Mert A.

National Instruments

0 Kudos
Message 4 of 5
(3,526 Views)

Sorry my mistake, there are 46 controls on tab 0 and 23 on tab 1.

 

After reading in the data from the file for all 69 controls, the Populate function updates all the controls except CROSSPOSN_X_CROSS_1 on tab 0, it remains as 0.000.  If I then save the data again (without changing the contents of CROSSPOSN_X_CROSS_1) then the correct value is saved.  (The values are returned to a Local in TestStand via a function parameter list which I can then see).

 

If I call the Populate function twice then all 69 controls are updated.  Calling it twice seems to work, but it seems a bit odd as to why.

Christopher Povey

Principle Test Systems Engineer for BAE Systems.
0 Kudos
Message 5 of 5
(3,515 Views)