LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Use LabWindows/CVI tab control in visual c++ 2005 but get error message when run LoadPanel( )

Hi all,
 
I use LabWindows/CVI 8.0.1 and Visual Studio 2005 (C++).
I convert my old LabWIndows project to Visual C++ project by LabWindows/CVI conversion wizard.
I can compile Visual C++ project and have no program.
I can run compiled executable successfully
 
But I have trouble when I use tab control.
There are my steps as follows:
 
1. Add a tab control on UI.
2. Add a command button control on the first tab page of the tab control.
3. Set a callback function CbTest() to the command button.
4. Generate the callback function.
5. Compile the Visual C++ project. I compile it successfully.
6. Run the compiled executable.
 
 
Then, I get error message as follows:
 
========================================================
Error in call to LoadPanel.
 
Parent Panel Handle: 0
UIR File Name: example.uir
Panel Resource ID: 1
 
Error Code: -86
 
The callback function, CbTest, specified in the UIR file, is not a known function.
If you are using an external compiler, you must include the UIR callbacks object
or source file in the executable or DLL.
=========================================================
 
 
After get the error message, I do some experiments.
 
1. Use origin LabWindows/CVI environment to compile project,
    Get no problem and program runs well.
    The callback of the command button on the tab works successfully.
 
2. If i move the command button from tab control to main panel
    and compile the project in Visual C++,
    I will get no error message on running time.
    And the callback of the command button still works successfully.
 
 
 
Is there any detail i forget when i use tab control?
 
Thank you for your help!
 
 
 
0 Kudos
Message 1 of 5
(3,527 Views)
CVI 8 does not always generate the prototypes in the file for the external compiler support for the controls on tabs. This is a (known?) bug. As a work around I use an extra panel with a copy of all the controls on the tabs. Multiple controls can call the same callback, so this is no problem. You don't need to load this panel in your program.

By the way: if you have Callback_Foobar and Callback_foobar, CVI only genrates one prototype. There appears to be an case insensitive compare inside where there should not be one.
-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 2 of 5
(3,498 Views)
I hadn't heard of this bug before. I created a callback table from samples\userint\tabexample.uir and it did include the callbacks for the controls in the tabs, but of course it might only happen with some UIR files. If you have one lying around, would it be possible for you or Jimmy to attach a .UIR for which it does not generate all the callbacks, so that we can investigate this issue?

By the way, I did reproduce the problem you mentioned, with the case-insesitivity. We're going to look into that as well.

Thanks,

Luis
NI
0 Kudos
Message 3 of 5
(3,464 Views)
Er... never mind my last post. A co-worker just investigated this some more, and he noticed that it doesn't generate the tab control's callbacks if the .uir is closed. If the .uir is open (which it was when I tested it) it does generate them. So don't worry about attaching anything. We should be able to fix it now.

Luis
0 Kudos
Message 4 of 5
(3,457 Views)

Hi all,

 

I am Jimmy. Thank you all for your help.

I try the method provided by Luis and it works.

 

I also find that one can use LabWindows/CVI to generate the UIR callbacks source file to replace UIRCallbackTable.c.

(Build => External Compiler Support => Choose "Source File" in UIR callbaks and set the file path to UIRCallbackTable.c

=> Create)

The method also generates all callbacks including the control callbacks on tab page.

It works, too.

 

Thank you all very much.

 

 

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