Hello all!
I have created 3 toggle buttons, namely apple, pear and orange.
I have also input their respective names into the Pt_ARG_USER_DATA. For example under the toggle button apple, I have typed in ‘a’ as the user data. Then I grouped these 3 buttons into a single group and set the Pt_ARG_GROUP _FLAGS to Pt_GROUP _EXCLUSIVE.
But the problem now is that I cannot select the toggles’ individual user data anymore. My aim is to allow the user to first select only one of the 3 toggle buttons, then the user presses the start button and the respective program for each toggle button runs. I have also written a switch(mode) program in the callback of the start button.(where mode is either apple, orange or pear). For example, when the user selects apple and then press the start button, a sentence “apple chosen” will be printed out in a text box.
My question now is, is this the correct way of setting up toggle buttons?
Below is my code, which only displays the default statement no matter which toggle button is chosen.
int start(PtWidget_t *widget, Apinfo_t *apinfo, PtCallBackInfo_t *cbinfo)
{
char mode;
PtArg_t args[5];
switch(mode)
{
case 'a': PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "apple chosen",0)
PtSetResources(ABW_base_text, 5, args);
break;
case 'p': PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "pear chosen",0)
PtSetResources(ABW_base_text, 5, args);
break;
case 'o': PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "orange chosen",0)
PtSetResources(ABW_base_text, 5, args);
break;
default:PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "Nil chosen",0)
PtSetResources(ABW_base_text, 5, args);
break;
}
}
What is wrong? Can anyone help me?
Thanks in advance!