LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

library function error invalid control ID when updating to CVI version 8.

I have several applications that we have developed in CVI versions 6 and 7. I moved these projects to version 8 (8.5). When I add a panel to the application, there seems to be a change in the value of the symbols (at least panel numbers) in the corresponding .h file (I do expect his to happen). When the program is rebuilt and executed, it seems to be using the old panel numbers. I have tried to remove and add back the .h file but no luck. What am I missing? Thanks in advance for your help
0 Kudos
Message 1 of 3
(5,414 Views)

Hi tucis,

 

Every time you make a modification to a UIR file and then save it, CVI automatically generates a new header (.h) file that contains the appropriate callback functions and the ID constant names associated with your panels and controls.  In your case, you forced a change by adding a new panel to your UIR and then you probably saved it. When you did this, a new header file was created with the same name as your UIR.  Allow me to explain in a little more detail..

 

Controls in the User Interface Editor are recognized in CVI by their constant name and Control ID.  The User Interface Editor appends the constant name of the control to the constant name of the panel to create the Control ID.  For example, if the constant name of the panel is PANEL, and the constant name of the control is GENERATE, then the Control ID is PANEL_GENERATE.  These Control IDs are defined in the header file that CVI generates when you save the .uir file.  You use these Control IDs with the control-specific functions, such as GetCtrlVal and SetCtrlAttribute

 

Now, with all that said, my guess as to what is happening is that your source code is actually using the numerical constants associated with the Controls IDs (which can be fond in the UIR header file) which isn't good practice.  You should always use the actual Control ID name and not the value associated with it because these values can change based on changes you make in the UIR such as changing the tab order, adding/deleting controls, adding a new panel, etc. So you are probably calling some control-specific function using a ID that has changed and its no longer valid (i.e. maybe you are trying to set a LED attribute for a numeric control as this used to work becuase the numerical value happened to correspond to a LED control but now it doesn't).

 

If you are using the numerical value, then I would suggest changing your code to use the Control IDs to avoid further issues. 

 

If you are still having issues and the information I mentioned hasn't helped, maybe you should post a small project that I could run and see the error. From that I should be able to quickly tell you the problem.


Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 2 of 3
(5,406 Views)
Thanks for your reply Jonathan.
I do use the control IDs in the code. That is what I found so surprising. Using the debugger, I looked at  the values of the control IDs in the call that produced the error. It did not match the control ID in the .h file. In fact, it was using the value of the control ID from the original ( CVI version 6 ) code. The only errors in control ID are in the panel ID numbers.

After I migrated the project to CVI 8.5 and made some changes to a panel and added a panel, I built a debug version of the program. It was in this version that I found errors. After trying many things to force the code to use the current .h file for the UIR, I could not get the new control ID values to be used.

After posting my message, I continued to experiment.
Finally, I built a release version of the project . The program worked fine - no errors. It is using the new values of the .h file.

I then rebuilt the debug version, it also runs with no errors and uses the correct panel ID values.

I am not sure what caused the 'turn around'. Is there something that may have occued when the release version was built that forced use of the newest .h file for the UIR?

0 Kudos
Message 3 of 3
(5,396 Views)