LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetCtrlArr​ayFromReso​urceID

Hello Kudos,

 

Thank you for replying the answer.

Today the blog allows me to create a new post. Yesterday it keeps me to go to survey pages.

Your answer makes sense to me and agreed to your point.

 

But header file was generated automatically ... 

Is that mean I neeed correct it on header file manually or source file ? 

Should the header file contain like pnlDigCnCHandle_CTRLARRAY  instead of CTRLARRAY for that one?

 

Humm...  

 

1. I created the toggle button on the panel and created Control array by pressing the right mouse button .

2. I chose the "new" control array.

3. Then I added other button controls into the same control array by using right mouse button. 

 

On the attached screen shot, the control array looks like to be located to the correct panel but it does not looke like on the header file.

 

Thank you.

 

GetCtrlArrayFromResourceID

 

Hello ,

 

I am using CVI2010 and trying to use Control Array but I am stuck with "Resource Invalid error".

I can't create the control array handle. Did I miss somthing? I assined the buttons to CTRLARRAY.

 

Thank you,

 

Insuk

 

 

 

My header file has both Panel and Control array constants:

 

#define  PnlDigCNC                               2

#define  PnlDigCNC_STRING                 2       /* control type: string, callback function: (none) */

#define  PnlDigCNC_TOGGLEBUTTON_8         3       /* control type: textButton, callback function: (none) */

#define  PnlDigCNC_TOGGLEBUTTON_7         4       /* control type: textButton, callback function: (none) */

#define  PnlDigCNC_TOGGLEBUTTON_6         5       /* control type: textButton, callback function: (none) */

 

#define CTRLARRAY 1

 

 

Source file :

 

if (pnlDigCnCHandle == 0){    

if ((pnlDigCnCHandle = LoadPanel (0, "Cnc.uir", PnlDigCNC))<0)     

return -1;   

}      

DisplayPanel(pnlDigCnCHandle);    
   if (pnlDigCnCHandle > 0 ){    

DigSWarray = GetCtrlArrayFromResourceID (pnlDigCnCHandle,CTRLARRAY );    

}   

 

Error :

Library function error(return value == -24) Resource ID not found in user interface resource file.

 

0 Kudos
Message 1 of 7
(4,534 Views)

momo2013 wrote:

Is that mean I neeed correct it on header file manually or source file ? 

No, you should never edit the UI header file manually!

 

I just checked the sample ledctrlarray that ships with CVI and I realized that your code snippet

GetCtrlArrayFromResourceID ( pnlDigCnCHandle, CTRLARRAY ) should be fine.

 

However, for a return value of -24 my help file (CVI2012SP1) says: Invalid panel ID or menu bar ID in resource file

 

Suspicion: do you use tabpanels?

0 Kudos
Message 2 of 7
(4,525 Views)

No. I do not use Tabs but I am using the multiple panels at the same time . 

Is that making problem to recognize the contrl array? I see.... Thank you.

 

Source code


   if (pnlDigHandle == 0){
    if ((pnlDigHandle = LoadPanel (0, "Cnc.uir", PnlDigital))<0)
     return -1;
   }
   DisplayPanel(pnlDigHandle);
   
   if (pnlDigCnCHandle == 0){
    if ((pnlDigCnCHandle = LoadPanel (0, "Cnc.uir", PnlDigCNC))<0)
     return -1;
   }
   
   DisplayPanel(pnlDigCnCHandle);  
   
  
if (pnlDigCnCHandle > 0 ){
    DigSWarray = GetCtrlArrayFromResourceID (pnlDigCnCHandle,CTRLARRAY ); 
   }
 

 

 

 

Thank you,

 

Insuk

0 Kudos
Message 3 of 7
(4,523 Views)

Hello Kudos,

 

Maybe I need to get panel information by using GetCtrlArrayPanel (int controlArrayHandle)???

In the case I could not create 'controlArrayHandle' then how can I get the panel information?

 

 

Thank you,

 

Insuk

 

0 Kudos
Message 4 of 7
(4,521 Views)

You don't need to call GetCtrlArrayPanel. If you already know which panel handle is associated with your control array, you can pass it directly to GetCtrlArrayFromResourceID.

 

Looking at your jpg and your source code, I don't see an obvious reason for this error. Can you try out the userint\ledctrlarray.cws example program and see if that works for you? If not, I suggest that you start experimenting with your own panel, gradually turning it into the panel that is in the example program, so that you can find out what exactly is making the difference. Alternatively, you can attach some reduced version of your program that reproduces the error here in the forum, and I can take a look at it.

 

Luis

0 Kudos
Message 5 of 7
(4,472 Views)

Hello Kudos,

 

I experimented with small testing programs. Those testing programs(source attached) are working with Control Arrays.  Smiley Wink

 

But I deleted the control array part at my origininal program(error throwing...) by replacing with with other controls so I am not sure which part is different. when I have time, I will try to implment that at my original program. 

        

Thank you,

 

Insuk 

 

Tested source files are attached(No error).

 

 

int CVICALLBACK fOpenNew (int panel, int control, int event,   void *callbackData, int eventData1, int eventData2)

{  switch (event)  {  

 

 case EVENT_COMMIT:

 Ch1Handle = LoadPanel (0, "ctrlarray2.uir", PANEL_Ch);    

Ch2Handle = LoadPanel (0, "ctrlarray2.uir", PANEL_Ch2);    

DisplayPanel (Ch1Handle);    

DisplayPanel (Ch2Handle);            

ctrlarray = GetCtrlArrayFromResourceID (Ch1Handle, CTRLARRAY);   

SetCtrlVal (Ch1Handle, ctrlarray, 1);                            

break;

 }  

return 0;

}

 

 

Download All
0 Kudos
Message 6 of 7
(4,428 Views)

If you're still stuck on this problem, something else you can try is to run the CVI logging configuration utility (c:\Program Files (x86)\National Instruments\CVI2010\bin\ConfigCVILogging.exe), select the Runtime Engine at the top of the panel, check the "Warning" message, specify a file to log the output file to, then click Apply. Then, run your program and after the error occurs, look for the file that you specified.

 

You can attach the log file here in the forum, which might give us a clue about where the error is coming from.

 

Luis

0 Kudos
Message 7 of 7
(4,387 Views)