LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

threads, tabs and duplicate controls

I have taken the simpdemo example from Labwindows/CVI and tried to modify it. I have put the tab panel ID's in an array and added 3 controls to the HELP panel which I duplicate 6 times. These control ID's are again put in an array.

The code is like this:
panel = LoadPanel(0, "simpdemo.uir", PANEL);

/* Two function calls and, Voila!, a tab sheet dialog */
tabCtrl = EasyTab_ConvertFromCanvas(panel, PANEL_CANVAS);
EasyTab_LoadPanels (panel, tabCtrl, 1, "simpdemo.uir", __CVIUserHInst, CONTROL, &panelArray[0],
VALVES, &panelArray[1], MONITOR, &panelArray[2], CONFIG, &panelArray[3], HELP, &panelArray[4], 0);
Init();
InstallPopup(panel);
RunUserInterface();
return 0;
}

int Ini
t(void)
{
int i,
status,
Top,
Left;

Top = 260;
Left = 50;
for(i=0; i<6; i++)
{
Num1Array[i] = DuplicateCtrl(panelArray[4], HELP_NUMERIC_1, panelArray[4], "", Top, Left);
Num2Array[i] = DuplicateCtrl(panelArray[4], HELP_NUMERIC_2, panelArray[4], "", Top, Left+79);
TextArray[i] = DuplicateCtrl(panelArray[4], HELP_TEXT, panelArray[4], "", Top, Left+165);
Top = Top + 22;
}
DiscardCtrl(panelArray[4], HELP_NUMERIC_1);
DiscardCtrl(panelArray[4], HELP_NUMERIC_2);
DiscardCtrl(panelArray[4], HELP_TEXT);
return(0);
}

panelArray[5]; Num1Array[6];Num2Array[6];TextArray[6];panel and tabCtrl are global variables.

The problem is that I get a general protection error message, which has something to do with threads, with which I am not very familiar currently. Is there any way around this problem or do I need to get some insight i
nto threads ?

Any help would be appreciated.

Erik Wegman
email ewegman@csir.co.za
0 Kudos
Message 1 of 4
(3,310 Views)
I tried your modifications and didn't get the GPF error, so it's possible that the reason for this error lie in other modifications you made in the original project.
My only problem was this non-fatal error when quitting the application: Attempting to free pointer to memory not allocated by malloc or calloc that I don't know where originates.

Please report your exact error message here, so we can try to help you in debugging the application.

Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(3,309 Views)
I had the same problem. Try this: after you duplicate control set it's callback pointer to NULL:

SetCtrlAttribute(hPanel, hControl, ATTR_CALLBACK_FUNCTION_POINTER, NULL);

It helped in my case.
0 Kudos
Message 3 of 4
(3,310 Views)

Thanks mkrol for this answer, it helped also solving my problem with DiscardCtrl when the control was used on a Tab Control.

0 Kudos
Message 4 of 4
(3,224 Views)