03-23-2006 08:16 AM
03-23-2006 10:49 AM
Hello,
does the error occur when the LoadPanel function is executed?
03-23-2006 10:54 AM
03-23-2006 11:57 AM
Hi,
Thanks Roberto and Wim for replying back. Roberto here is the code. i have put this in a separate .c file
int CVICALLBACK EdgesCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
edge_handle = LoadPanel (edge_handle, "edges.uir", EDGE);
RecallPanelState (edge_handle, "edges.uir",1); //loads the previous saved panel by user
DisplayPanel (edge_handle);
}
return 0;
}
int CVICALLBACK CloseCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
DiscardPanel (edge_handle);
break;
}
return 0;
}
I dont know why but i have been loading different panels n wrks fine but all the tiem the code has been in the same main.c file....this time i hv it in another file..the first time it wrks fine....bt then after closing it, if i click on the button again i get the error msg.......it crashes at LoadPanel because the error handle is -4.
I guess its something simple but hard to see. hope you can solve it for me.
Thanks
k1_ke
03-23-2006 01:40 PM
03-23-2006 01:57 PM
Hi, thanks for the reply. Sorry for having the RecallpanelState....i was just trying it. I didnt hv it before and still crashed even having it there no luck.....
Do you think i can call a uir file which is in another .c file....and i used a button that is on my main uir (main.c)... e.g main.uir has the button.....the callback is in a file edge.c......and the panel i want to load then is edge.uir.....
I will try saving it to a different panel name and get back to you.
thanks
k1_ke
03-23-2006 03:58 PM
03-24-2006 01:06 AM - edited 03-24-2006 01:06 AM
Hi,
I think , your problem is in call LoadPanel with invalid parent panel handle
1 state :run EdgesCallback ()
edge_handle = LoadPanel (edge_handle, "edges.uir", EDGE);//edge_handle is replace by new panel
2 state :run CloseCallback ()
DiscardPanel (edge_handle); //edge_handle is now invalid
3 state :run EdgesCallback ()
edge_handle = LoadPanel (edge_handle, "edges.uir", EDGE); //invalid edge_handle is used a s parent
ovrabek/CZ
Message Edited by ovrabek/CZ on 03-24-2006 08:18 AM
03-24-2006 03:07 AM
Hi k1_ke,
I think there is another way to solve your problem, at least is how i do it when working with more than one panel, and it doesn't fail. First in the main function you load all the panels, but only display the main panel or the first you want to appear, then when you want to change from a panel to other you do:
int CVICALLBACK EdgesCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
HidePanel (main_panel); //Hides/closes the main panel
DisplayPanel (edge_handle); //Shows/opens the edge panel
}
return 0;
}
int CVICALLBACK CloseCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
HidePanel (edge_panel); //Hides/closes the edge panel
DisplayPanel (main_handle); //Shows/opens the main panel
break;
}
return 0;
}
Finally before exiting the application you discard all the panels you have loaded in the beginning, so really you are working with all the panels loaded, but you only show the ones you want to show ![]()
Hope it helps you
Juan
03-24-2006 07:40 AM
HI Guys,
Thank you very much for replying. I was able to solve my problem wiht Juan's suggestion....now i load the panels in the start and show or hide according to what i want...wrks fine.
ovrabek/CZ - yeah i knew that was my problem...jus wanted to figure a way around it but Juan was able to help me out. thanks for ur help
Luis G - thank you for ur input also....yeah well see the first the it wasnt workign so i was tryin to save the panel....change the state index and load the new index.....but that wasnt doing the trick for some reason...mayb i had to change the file name too....but i hv used savepanel state in my previous project n wrks fine...bt the same method didnt here.
In the end i was able to solve the problem.
Thanks
k1_ke