LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Use to .uir files

Solved!
Go to solution

Hello community,
I have four panels on one .uir file and was adding more content, until CVI got out of memory. I searched for solutions and found that I may need to split my content on different .uir files. I did it, but the buttons, gauges, etc that I took away aren't recognized on my main code. I get the next error: use of undeclared identifier 

 

How do I call the new .uir file? 

Thanks in advance

0 Kudos
Message 1 of 5
(3,107 Views)
Solution
Accepted by topic author Lamb25

Hi Lamb25,

 

A few questions: 

1.) Was there a specific message you received when you the CVI "got out of memory"? Like a code of some sort?

2.) Was there an error code for the undeclared identifier? 

 

You should be able to call the panel through the following functions: 

 

static int panelHandle; 

int main()

{

    // Change the panelHandle to whatever handle you would like. 

    // Match the name of .uir file to the one that contains your uir file. 

    // PANEL swapped to the constant name used to identify your panel. 

    if ((panelHandle = LoadPanel (0 , "sample.uir", PANEL)) < 0)

        return -1; 

    DisplayPanel(panelHandle); 

    RunUserInterface(); 

    DiscardPanel(panelHandle); 

    return 0; 

}

 

If I am not mistaken, it is likely that the controls when you moved them to a different panel or different .uir's that their constant name changed. You can find out what the new name is in the main project's header file. 

 

Regards,

Vincent

 

 

Message 2 of 5
(3,097 Views)
Solution
Accepted by topic author Lamb25

Of course you need to add the include files for the new UIR files to your code; and pass the correct file name in LoadPanel call.

And you may want to add the UIR files itself to the project: it's not mandatory but it helps getting things clear.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 5
(3,090 Views)

Hello community, 

Thanks Vincent and Roberto, both answers helped me.

The solucion was: #include "GAUGES.h"

I call this panel with the button "GAUGES"  and in the button call back the next code worked:

 

//==============================================================================
// SEND MESSAGES TO THE GAUGES (BTN_GAUGES: GAUGES)
int CVICALLBACK sendGAUGES (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_LEFT_CLICK:

int error = 0;

/* initialize and load resources */
errChk (panelGAUGES = LoadPanel (0, "GAUGES.uir", PANEL_GAUG));

/* display the panel and run the user interface */
errChk (DisplayPanel (panelGAUGES));
errChk (RunUserInterface ());

SEND_STRING(CS);
SEND_STRING(SN);
turnOffAllTelltales();

Error:
/* clean up */
if (panelGAUGES > 0)
QuitUserInterface (0);

break;
}

return 0;
}

Download All
0 Kudos
Message 4 of 5
(3,073 Views)

Glad to hear that.

Just as a side note, if you aready running the program with RunUserInterface (as you are for sure, otherwise the button callback wouldn't fire), you shouldn't call it again: it is unnecessary and can mess thing up.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 5 of 5
(3,068 Views)