07-24-2022 11:34 PM
I have created a uir in which menu are involved as user can chose the any option on that menu but what I need is when user chose any option it should go to new pannel .
EXAMPLE:
int CVICALLBACK PANNEL_1 (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
helloworld_handle= LoadPanel (main_handle, "my_pro.uir", PAN_1);
InstallPopup (helloworld_handle);
SetCtrlVal (helloworld_handle, PAN_1_COMNO , &comno); // value to be display
SetCtrlVal (helloworld_handle, PAN_1_BAUND_RATE , &baund_rate); // baund _rate value to be display
int CVICALLBACK COMNO (int menubar, int menuitem, void *callbackdata, int panel)
{
switch (comno)
{
case 1:
printf("case 1 is working");
break;
case 2:
printf("case 2 is working");
break;
}
return(0);
}
break;// PANNEL_1
} // PANNEL_1
return 0; // PANNEL_1
}// PANNEL_1
PLEASE check whether it works .
07-26-2022 05:04 AM
This framework cannot operate correctly: you cannot nest callback functions one into the other.
The correct way to write the code is:
FUNCTION 1:
Load a panel
Populate controls on the panel
Display it with either DisplayPanel or InstallPopup
Exit the function
MENUFUNCTION 1
...
Exit the function
MENUFUNCTION 2
...
Exit the fuction
(Write menu functions with appropriate commands as separate blocks of code)
After the first function is executed (and terminated) the panel will be on screen and CVI will sit in RunUserInterface processing events: when the user chooses a menu function, the corresponding callback function will be executed.