08-03-2006 08:00 PM
08-04-2006 01:50 AM - edited 08-04-2006 01:50 AM
Hi Steve,
actually it's quite easy to program such a group yourself. All you have to do is give each group number the same callback function and then check the control parameter to see which group number has been clicked. I give you an example of how to adjust the user interface to make sure only one toggle button is active:
int CVICALLBACK ButtonGroupCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2) {
// This is the callback function for the toggle buttons.
switch (event) {
case EVENT_COMMIT:
// Adjust the user interface.
SetCtrlVal (pnl, PNL_BUTTON1, control == PNL_BUTTON1);
SetCtrlVal (pnl, PNL_BUTTON2, control == PNL_BUTTON2);
SetCtrlVal (pnl, PNL_BUTTON3, control == PNL_BUTTON3);
break;
}
return 0;
}
You can write similar functions to check which button is active and take action depending on the activated button.
I have attached a small example program, dealing with toggle buttons and LED's.
Message Edited by Wim S on 08-04-2006 08:51 AM
08-04-2006 10:08 AM
08-04-2006 10:22 AM
08-04-2006 10:22 AM
08-04-2006 10:26 AM
Hello Steve.
The '==' statement is actually an encapsulated 'if' statement. The comparison will return 1 or 0, which is exactly the value you need in the SetCtrlVal function.
You could also write SetCtrlVal (pnl, PNL_BUTTON1, control == PNL_BUTTON1? 1 : 0);