Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5365

A strange control array error

$
0
0

Template code(from help document):

GetNumCtrlArrayItems(ctrlArray, &count);
   for (i=0; i<count; i++)
      SetCtrlVal(panelHandle, GetCtrlArrayItem(ctrlArray, i), i%2);

 

My user interface info:

I define 2 control arrays ,here are my panel and arrays

panel.jpgarray.jpg

 

My call back code of OK button:

int CVICALLBACK Ok (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
    int i,temp_control,count;
    switch (event)
    {
        case EVENT_COMMIT:
        GetNumCtrlArrayItems(CTRLARRAY_2, &count);
        for (i=0; i<count; i++)
       {
            temp_control = GetCtrlArrayItem(CTRLARRAY_2, i);
            ResetTextBox(panelHandle, temp_control, "test");
       }  
       break;
     }
     return 0;
}

 

This is the problem:

I want to change the text in the text box, according to the define of control array ,we should call 

GetNumCtrlArrayItems(CTRLARRAY, &count);and GetCtrlArrayItem(CTRLARRAY, i);

but, when I click ok button, funtion GetNumCtrlArrayItems return -4.

 

And, I use CTRLARRAY_2 instead of CTRLARRAY, when I click ok button, the result is like this

result.jpg

 

Who can explain this for me ?  Is this a bug of Labwindows/CVI 2013?Thank you very much .

 


Viewing all articles
Browse latest Browse all 5365

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>