I am using Labwindows/CVI 5.0.1.
My aim is to use a toggle button to control a digital output using the
following Callback.
//--------------------------------------------------------------------
int CVICALLBACK operate_mci (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
char control_value;
switch (event)
{
case EVENT_COMMIT:
//toggle mci output
GetCtrlAttribute (IPBpanelHandle, control, ATTR_CTRL_VAL,
&control_value);
DIG_Out_Line (DIO, IPB_SWITCH_PORT, IPB_MCI, !control_value);
break;
}
return 0;
}
My problem is that this code fails at run time with the message,
"array argument to small" and it refers to the "&control_value".
My understanding from the extremely limited references to toggle buttons
in the manuals is that a toggle button control has a value of either 1
or 0. I have determined from table 3-12 of the User Interface reference
that the attribute "ATTR_CTRL_VAL" is the "same type as control type"
however I have not found anything that defines what type a Toggle button
control is.
I have tried every control type in the list of control types, each
generates an error. Most in the form "found pointer to short int,
expected pointer to char". The exceptions are when I define
control_value as char or unsigned char and in both cases I get the
"array argument to small" message.
Have you any suggestions as to where I am going wrong with this?