LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with reloading EasyTab...

Reloading EasyTab crashed WinME (error -45 The control type passed was not a valid type.). I used LabWindows/CVI version 5.5.1. I created command buttons to load/unload Easytab. For the first time, load and unload is ok. However, when I click on Load_EasyTab again, the system hangs and the machine must reboot.

Here is my codes:

static int EasyTabPanel, tabCtrl;

EasyTabPanel = LoadPanel (0, "EasyPanel.uir", EASYPANEL);

int CVICALLBACK Load_EasyTab (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
tabCtrl = EasyTab_ConvertFromCanvas(EasyTabPanel , EASYPANEL_CANVAS);
EasyTab_LoadPanels (EasyTabPanel, tabCtrl, 1, "EasyPa
nel.uir", __CVIUserHInst, CARD, 0,
CHANNELS, 0, PROTO, 0, 0);

InstallPopup(protosel);
break;
}
return 0;
}

int CVICALLBACK Unload_EasyTab (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
RemovePopup (1);

break;
}
return 0;
}
0 Kudos
Message 1 of 2
(2,944 Views)
The error you are getting is correct. You are calling ConvertFromCanvas which expects the control to be a canvas. The second time you call it, it isn't a canvas anymore. You should call ConvertFromCanvas and LoadPanels only ONCE. There should really be no need to reload the tabbed panels, but in case you have to, Discard and Reload the parent panel (EasyTabPanel) and that will reset the control back to a canvas.

Best Regards,

Chris Matthews
Measurement Studio Support Manager
0 Kudos
Message 2 of 2
(2,944 Views)