03-21-2016 01:17 AM
Hello,
I have a problem with GetCtrlVal. Wenn I start my application and Quit it I get this error message: NON-FATAL RUN-TIME ERROR: "Test.c", line 206, col 5, thread id 0x00001A4C: Function GetCtrlVal: (return value == -13 [0xfffffff3]). Invalid control ID
I have checked the control ID and there should be no problems with it. I have this problem also when I run my application write some values in there and after the applications finished and I would like to quit the application with the standard quit button.
double Amplitude=0, DutyCycle=0;
int Mode=0, Samples=0, SampleRate=0;
GetCtrlVal (panel, Panel_TREE, &Mode);
GetCtrlVal (panel, Panel_Amplitude, &Amplitude);
GetCtrlVal (panel, Panel_SampleRate, &SampleRate);
GetCtrlVal (panel, Panel_Samples, &Samples);
GetCtrlVal (panel, Panel_DutyCycle, &DutyCycle);
switch (event)
{
case EVENT_COMMIT:
switch(Mode)
........
Best Ragards
Solved! Go to Solution.
03-21-2016 02:23 AM
I think the problem could be in the "panel" variable (firs parameter of GetCtrlVal function).
You should dobule check that "panel" refers to "Panel" where the controls Panel_TREE, Panel_Amplitude, ... exist
The variable panel is assigned with LoadPanel function
03-21-2016 02:41 AM
This kind of error can also arise if the control you are accessing is on a tab page (i.e a page of a tab control): in this case in 'panel' parameter you must pass the handle of the tab page itself and not the handle of the panel the tab control is in. Handles for the pages of a tab control can be retrieved with GetPanelHandleFromTabPage instruction.
03-21-2016 02:53 AM
I controlled my Panel Handle variable but the failure occured again.
For the variable I used a simple numeric field.
03-21-2016 03:08 AM
Are you using tab controls? Is your control on a tab page?
Can you post your app here? I do not mean the entire application but a stripped down version the only handles the user interface and shows the misbehaviour you are seeing.
03-21-2016 04:01 AM
I do not use a tab control.
In the following you can see the interface and the panel tree.
Now I have also the problem, that every new made GetCtrlVal has the problem with the failure message above.
03-21-2016 04:37 AM
Have you tried moving all GetCtrlVal inside the EVENT_COMMIT clause?
You say you have the problem at program end: in this case, the event is probably EVENT_DISCARD, which is sent to all controls and panels in the application; at some moment you may be accessing a control which has been already removed from memory. Those GetCtrlVal statements are executed for *ALL* events received from the control, even on every single mouse movement: this is an unnnecessary use of resources that can put you in unwanted situations.
03-21-2016 04:37 AM
If the panel name is "AWG" and the control name is "TREE", the control ID is "AWG_TREE" not "Panel_TREE" as you wrote in your first message.
This is a really basic concept in LabWindows/CVI.
I suggest you to spend some time with some tutorials and how-to, before starting to write your own application.
This would save you a lot of time in the future, during the development.
03-21-2016 05:15 AM
Thank you RobertoBozzolo, that was the solution.
Best Regards