NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

UIR #define weirdness

This message kept exceeding 5000 characters, so I had to put it in an attachment.  Sorry for the inconvenience.
0 Kudos
Message 1 of 8
(4,107 Views)

It looks like you are using both a UIR and the code generated by the tool that converts UIRs to source code. You should do one or the other, not both.

If there is no problem using .UIR files, you should not turn them into source code because maintainence is easier in UIR form.  Perhaps you were trying to generate the callback function stubs for the UIR and selected the feature to turn it into code by mistake?

0 Kudos
Message 2 of 8
(4,102 Views)
How do I only generate the callback function stubs?
0 Kudos
Message 3 of 8
(4,092 Views)
Make sure you use the items in the Code menu instead of the Tools>>UI to Code Converter.
0 Kudos
Message 4 of 8
(4,080 Views)
What about the question about the preferred way to use errChk - one uses LoadPanelEx, the other does not.
 
(1) if (gMainWindow.aboutBox <= 0)                 errChk( gMainWindow.aboutBox =
    LoadPanelEx(0, "TestExec.uir", ABOUTBOX, __CVIUserHInst));
 
(2) But in the other file (ATE_Register.c), the calls to errChk looked like this - no mention of the .UIR
    // Create the panel
    errChk(hPanel = NewPanel (hParentPanel, "ATE Registration", 759, 1315, 333, 552));
    // Set the panel's attributes
    errChk(SetPanelAttribute (hPanel, ATTR_CONSTANT_NAME, "ATE_REG"));
0 Kudos
Message 5 of 8
(4,072 Views)
errChk is just a simple macro to check function return codes and jump to an Error label if the code is negative. It has nothing in particular to do with UIRs or panel loading.
 
Here is the definition of errChk:
 
#ifndef errChk
#define errChk(fCall) if (error = (fCall), error < 0) \
{goto Error;} else
#endif
 
Note that is assumes that you have an integer variable named error in scope and that you have a label named Error that you want to jump to if the function returns a negative code.
 
The purpose of the errChk macro is to help you to implement error code checking with less typing.
0 Kudos
Message 6 of 8
(4,067 Views)
I guess a better question would have been, Is there a preferred way to create the panel references (with/without LoadPanelEx and the UIR reference)
0 Kudos
Message 7 of 8
(4,064 Views)

LoadPanelEx is for loading a panel from a UIR file. All the attributes are set and all controls are created as specified in the UIR.

NewPanel is for creating a panel purely from code. Your code must make a lot of calls to set all the attributes and create all the controls.

The Tools>>UI to Code Converter item takes a UIR file and converts it all to code consisting of NewPanel, NewControl, and SetAttribute calls. This code might be harder to edit than editing the UIR itself because you don't see the UI the code creates until you run it.

Message Edited by James Grey on 03-24-2006 12:36 PM

Message Edited by James Grey on 03-24-2006 12:36 PM

0 Kudos
Message 8 of 8
(4,061 Views)